Re: [PATCH v3 1/3] fbdev: bound mode sysfs output to the sysfs buffer
Helge Deller <[email protected]> Sat, 18 Jul 2026 22:04:41 +0200
| Newsgroups | org.kernel.vger.linux-fbdev,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
On 7/2/26 01:42, Melbin K Mathew wrote: > mode_string() uses snprintf() which can return a value larger than the > remaining buffer space. show_modes() accumulates the return value into i > without checking whether i has reached PAGE_SIZE, causing the offset to > advance past the sysfs buffer if the modelist is long enough. > > Add a size parameter to mode_string() and use scnprintf() to return > only the bytes actually written. Add an early return when offset > already exceeds the buffer. In show_modes(), stop accumulating once > the buffer is full. > > Cc: [email protected] > Signed-off-by: Melbin K Mathew <[email protected]> > --- > drivers/video/fbdev/core/fbsysfs.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) I've applied the series to fbdev git tree for further testing. Thanks! Helge