[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8860d9a3-ddc9-41a7-a6b2-d1a1a2bb2de6@moroto.mountain>
Date: Thu, 18 Jan 2024 08:18:22 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: "Keller, Jacob E" <jacob.e.keller@...el.com>
Cc: Julia Lawall <Julia.Lawall@...6.fr>, Kees Cook <keescook@...omium.org>,
"Gustavo A . R . Silva" <gustavoars@...nel.org>,
"cocci@...teme.lip6.fr" <cocci@...teme.lip6.fr>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Harshit Mogalapalli <harshit.m.mogalapalli@...il.com>
Subject: Re: [PATCH] coccinelle: semantic patch to check for potential
struct_size calls
On Wed, Jan 17, 2024 at 09:54:19PM +0000, Keller, Jacob E wrote:
> > drivers/misc/vmw_vmci/vmci_datagram.c
> > 227 dg_info = kmalloc(sizeof(*dg_info) +
> > 228 (size_t) dg->payload_size, GFP_ATOMIC);
> >
> > The Cocci check is looking specifically for:
> >
> > sizeof(*dg_info) + (sizeof(*dg_info->msg_payload) * dg->payload_size)
> >
>
> I think that's a slightly different formulation.
>
I thought that that was what the check was looking for. To me it seems
like an unusual way to write it, but it's not buggy and your Coccinelle
script did trigger a warning correctly... But yeah, I was slightly
puzzled why it would be in this format.
regards,
dan carpenter
Powered by blists - more mailing lists