lkml.org 
[lkml]   [2022]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 7/9] brcmfmac: of: Use devm kstrdup for board type & check for errors
On Mon, Jan 31, 2022 at 5:07 PM Hector Martin <marcan@marcan.st> wrote:
>
>This was missing a NULL check, and we can collapse the strlen/alloc/copy
>into a devm_kstrdup().

...

> /* get rid of '/' in the compatible string to be able to find the FW */
> len = strlen(tmp) + 1;
>- board_type = devm_kzalloc(dev, len, >GFP_KERNEL);
>- strscpy(board_type, tmp, len);
>+ board_type = devm_kstrdup(dev, tmp, GFP_KERNEL);

Also `len` can be dropped, since it is now unused.

--
Best regards,
Piotr Masłowski

\
 
 \ /
  Last update: 2022-01-31 23:49    [W:0.097 / U:1.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site