Re: [PATCH] staging: fbtft: Use sysfs_emit_at() to print to sysfs file
Andy Shevchenko <[email protected]>
| Newsgroups | org.kernel.vger.kernel-janitors,dev.linux.lists.linux-staging,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-fbdev,org.kernel.vger.linux-kernel |
|---|---|
| Organization | Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo |
| Message-ID | <[email protected]> |
On Wed, Jun 03, 2026 at 10:34:21AM +0300, Dan Carpenter wrote: > This scnprintf() uses the wrong limit. It should be "PAGE_SIZE - len" > instead of just PAGE_SIZE. We're not going to hit the limit in real > life since we are printing at most FBTFT_GAMMA_MAX_VALUES_TOTAL (128) > u32 values, however, it's still worth fixing. > > Use sysfs_emit_at() to fix this since this is a sysfs file. OK, Reviewed-by: Andy Shevchenko <[email protected]> ... > for (i = 0; i < par->gamma.num_curves; i++) { > for (j = 0; j < par->gamma.num_values; j++) > - len += scnprintf(&buf[len], PAGE_SIZE, > + len += sysfs_emit_at(buf, len, > "%04x ", curves[i * par->gamma.num_values + j]); Can we switch to use hex_dump_to_buffer() at some point? -- With Best Regards, Andy Shevchenko