mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 12:52:29 -04:00
staging: fbtft: Use sysfs_emit_at() to print to sysfs file
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.
Fixes: c296d5f995 ("staging: fbtft: core support")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Link: https://patch.msgid.link/ah_Y_Y2RtqeGxchF@stanley.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
6d45195a96
commit
221192a784
@@ -98,7 +98,7 @@ sprintf_gamma(struct fbtft_par *par, u32 *curves, char *buf)
|
||||
mutex_lock(&par->gamma.lock);
|
||||
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]);
|
||||
buf[len - 1] = '\n';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user