On Mon, Mar 01, 2021 at 08:13:54PM +0700, Candy Febriyanto wrote:
> @@ -5082,7 +5084,7 @@ static int rtw_ioctl_wext_private(struct net_device 
> *dev, union iwreq_data *wrq_
>               case IW_PRIV_TYPE_BYTE:
>                       /* Display args */
>                       for (j = 0; j < n; j++) {
> -                             sprintf(str, "%d  ", extra[j]);
> +                             scnprintf(str, sizeof(str), "%d  ", extra[j]);
>                               len = strlen(str);

You could save a little code and combine the two statements:

                                len = scnprintf(str, sizeof(str), "%d  ", 
extra[j]);

For bonus points, you could write a Coccinelle script to look for that
pattern of calling strlen() on a freshly sprintfed string.

>                               output_len = strlen(output);
>                               if ((output_len + len + 1) > 4096) {

regards,
dan carpenter
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to