Skip to content

Commit aa85923

Browse files
committed
crypto: hisilicon: Wipe entire pool on error
To work around a Clang __builtin_object_size bug that shows up under CONFIG_FORTIFY_SOURCE and UBSAN_BOUNDS, move the per-loop-iteration mem_block wipe into a single wipe of the entire pool structure after the loop. Reported-by: Nathan Chancellor <[email protected]> Link: ClangBuiltLinux#1780 Cc: Weili Qian <[email protected]> Cc: Zhou Wang <[email protected]> Cc: Herbert Xu <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Tested-by: Nathan Chancellor <[email protected]> # build Link: https://lore.kernel.org/r/[email protected]
1 parent 8500689 commit aa85923

File tree

1 file changed

+1
-2
lines changed
  • drivers/crypto/hisilicon

1 file changed

+1
-2
lines changed

drivers/crypto/hisilicon/sgl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev,
124124
for (j = 0; j < i; j++) {
125125
dma_free_coherent(dev, block_size, block[j].sgl,
126126
block[j].sgl_dma);
127-
memset(block + j, 0, sizeof(*block));
128127
}
129-
kfree(pool);
128+
kfree_sensitive(pool);
130129
return ERR_PTR(-ENOMEM);
131130
}
132131
EXPORT_SYMBOL_GPL(hisi_acc_create_sgl_pool);

0 commit comments

Comments
 (0)