lkml.org 
[lkml]   [2024]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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


    \
     
     \ /
      Last update: 2024-01-18 06:37    [W:5.438 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site