summaryrefslogtreecommitdiffstats
path: root/mm/memfd.c
diff options
context:
space:
mode:
authorPetr Mladek <pmladek@suse.com>2023-01-17 17:10:31 +0100
committerPetr Mladek <pmladek@suse.com>2023-01-18 10:13:50 +0100
commitd551afc25878924991a4c65299dfa83df1cb9ef8 (patch)
tree69bc16bf0230786d682ab264b8ae56ae373b7751 /mm/memfd.c
parentb0975c47c2178e35038b12ad63f17c64bb522684 (diff)
downloadlinux-stable-d551afc25878924991a4c65299dfa83df1cb9ef8.tar.gz
linux-stable-d551afc25878924991a4c65299dfa83df1cb9ef8.tar.bz2
linux-stable-d551afc25878924991a4c65299dfa83df1cb9ef8.zip
printk: Use scnprintf() to print the message about the dropped messages on a console
Use scnprintf() for printing the message about dropped messages on a console. It returns the really written length of the message. It prevents potential buffer overflow when the returned length is later used to copy the buffer content. Note that the previous code was safe because the scratch buffer was big enough and the message always fit in. But scnprintf() makes it more safe, definitely. Reported-by: coverity-bot <keescook+coverity-bot@chromium.org> Addresses-Coverity-ID: 1530570 ("Memory - corruptions") Fixes: c4fcc617e148 ("printk: introduce console_prepend_dropped() for dropped messages") Link: https://lore.kernel.org/r/202301131544.D9E804CCD@keescook Reviewed-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20230117161031.15499-1-pmladek@suse.com
Diffstat (limited to 'mm/memfd.c')
0 files changed, 0 insertions, 0 deletions