lkml.org 
[lkml]   [2016]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 08/18] [media] RedRat3: Improve another size determination in redrat3_send_cmd()
    From
    Date
    From: Markus Elfring <elfring@users.sourceforge.net>
    Date: Thu, 13 Oct 2016 13:31:17 +0200

    Replace the specification of a data type by a pointer dereference
    as the parameter for the operator "sizeof" to make the corresponding size
    determination a bit safer.

    Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
    ---
    drivers/media/rc/redrat3.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
    index 5832e6f..f6c21a1 100644
    --- a/drivers/media/rc/redrat3.c
    +++ b/drivers/media/rc/redrat3.c
    @@ -388,7 +388,7 @@ static int redrat3_send_cmd(int cmd, struct redrat3_dev *rr3)
    u8 *data;
    int res;

    - data = kzalloc(sizeof(u8), GFP_KERNEL);
    + data = kzalloc(sizeof(*data), GFP_KERNEL);
    if (!data)
    return -ENOMEM;

    --
    2.10.1
    \
     
     \ /
      Last update: 2016-10-13 18:34    [W:4.994 / U:1.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site