Re: [PATCH v2, variant B] tty: nozomi: avoid sprintf buffer overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 29, 2016 at 12:51:04PM +0100, Arnd Bergmann wrote:
> Testing with a gcc-7 snapshot produced an internal compiler error
> for this file:
> 
> drivers/tty/nozomi.c: In function 'receive_flow_control':
> drivers/tty/nozomi.c:919:12: internal compiler error: in get_substring_ranges_for_loc, at input.c:1388
>  static int receive_flow_control(struct nozomi *dc)
> 
> I've reported this at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78569
> but also noticed that the code line contains a stack overflow, as it prints
> a string into a slightly shorter fixed-length 'tmp' variable.
> 
> A lot of the code here is unnecessary and can be expressed in a simpler
> way, relying on the fact that removing the 'DEBUG' macro will also get
> rid of all pr_debug() calls. This change should not change any of the
> output but avoids both the stack overflow and the gcc crash.

I like this, but I don't think this patch went far enough, we should get
rid of the "special" macro entirely and just use dev_dbg() everywhere as
the dynamic debugging interface is exactly for this type of thing (you
can turn them on or off per-line, no need for odd "levels".)

So I'll take this patch now to remove the obvious error, but follow-on
patches to fix it up "correctly" would be great.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux