Re: [PATCH v4 7/9] brcmfmac: of: Use devm_kstrdup for board_type & check for errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 31, 2022 at 5:07 PM Hector Martin <marcan@xxxxxxxxx> 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




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux