Skip to content

Commit ce1fb07

Browse files
keesgregkh
authored andcommitted
coda: Avoid partial allocation of sig_inputArgs
[ Upstream commit 48df133 ] GCC does not like having a partially allocated object, since it cannot reason about it for bounds checking when it is passed to other code. Instead, fully allocate sig_inputArgs. (Alternatively, sig_inputArgs should be defined as a struct coda_in_hdr, if it is actually not using any other part of the union.) Seen under GCC 13: ../fs/coda/upcall.c: In function 'coda_upcall': ../fs/coda/upcall.c:801:22: warning: array subscript 'union inputArgs[0]' is partly outside array bounds of 'unsigned char[20]' [-Warray-bounds=] 801 | sig_inputArgs->ih.opcode = CODA_SIGNAL; | ^~ Cc: Jan Harkes <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent dca8fd0 commit ce1fb07

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/coda/upcall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ static int coda_upcall(struct venus_comm *vcp,
790790
sig_req = kmalloc(sizeof(struct upc_req), GFP_KERNEL);
791791
if (!sig_req) goto exit;
792792

793-
sig_inputArgs = kvzalloc(sizeof(struct coda_in_hdr), GFP_KERNEL);
793+
sig_inputArgs = kvzalloc(sizeof(*sig_inputArgs), GFP_KERNEL);
794794
if (!sig_inputArgs) {
795795
kfree(sig_req);
796796
goto exit;

0 commit comments

Comments
 (0)