From: Dan Carpenter <dan.carpenter@linaro.org>
To: "Keller, Jacob E" <jacob.e.keller@intel.com>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>,
Kees Cook <keescook@chromium.org>,
"Gustavo A . R . Silva" <gustavoars@kernel.org>,
"cocci@systeme.lip6.fr" <cocci@systeme.lip6.fr>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Harshit Mogalapalli <harshit.m.mogalapalli@gmail.com>
Subject: Re: [PATCH] coccinelle: semantic patch to check for potential struct_size calls
Date: Thu, 18 Jan 2024 08:18:22 +0300 [thread overview]
Message-ID: <8860d9a3-ddc9-41a7-a6b2-d1a1a2bb2de6@moroto.mountain> (raw)
In-Reply-To: <CO1PR11MB508917C85AAD2ADEFFDAA204D6722@CO1PR11MB5089.namprd11.prod.outlook.com>
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
next prev parent reply other threads:[~2024-01-18 5:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-27 20:24 Jacob Keller
2023-08-27 1:19 ` Kees Cook
2023-08-29 19:25 ` Jacob Keller
2024-01-16 7:03 ` Dan Carpenter
2024-01-17 21:54 ` Keller, Jacob E
2024-01-18 5:18 ` Dan Carpenter [this message]
2024-02-19 4:38 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8860d9a3-ddc9-41a7-a6b2-d1a1a2bb2de6@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=Julia.Lawall@lip6.fr \
--cc=cocci@systeme.lip6.fr \
--cc=gustavoars@kernel.org \
--cc=harshit.m.mogalapalli@gmail.com \
--cc=jacob.e.keller@intel.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®