Re: OMAP3 CPU Info has weird output in 4.9-RC1

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

 



* Ivaylo Dimitrov <ivo.g.dimitrov.75@xxxxxxxxx> [161025 06:03]:
> On 25.10.2016 01:53, Tony Lindgren wrote:
> >  static void __init omap3_cpuinfo(void)
> >  {
> >  	const char *cpu_name;
> > +	char buf[64];
> 
> Are we sure 64 bytes are enough for everybody :) ?

In this case yes the max is known :)

> I guess something like:
> 
> #define OMAP3_SHOW_FEATURE(feat)		\
> 	if (omap3_has_ ##feat()) {		\
> 		int __chars = scnprintf(bufp, sizeof(buf) - (bufp - buf), #feat" "); \
> 		WARN_ONCE(__chars != (strlen(#feat" "))); \
> 		bufp += __chars;
> 	}
> 
> will do a better job in the future. The similar needs to be done for the
> rest of the sprintfs. Otherwise we risk stack corruption if some fancy omap3
> appear out of the blue, iiuc.

In that case we'd have to add new code to parse the new features so it's
not like the hardware change alone would cause anything here.

> I didn't even compile-test the above, but I am sure you get the idea.

Sure, I'll change to use scnprintf and repost.

Regards,

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



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux