On Mon, Mar 01, 2021 at 04:41:09PM +0300, Dan Carpenter wrote: > 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]); Good catch, I'll send a V2. > > For bonus points, you could write a Coccinelle script to look for that > pattern of calling strlen() on a freshly sprintfed string. Sounds like a good idea, I don't know how to do it though so feel free. > > > output_len = strlen(output); > > if ((output_len + len + 1) > 4096) { > > regards, > dan carpenter _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel