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

Re: [Xen-devel] [PATCH 2/2] tools/tests/cpu-policy: disable -Wformat-overflow

On 09.08.2019 13:05, Ian Jackson wrote:
Jan Beulich writes ("Re: [Xen-devel] [PATCH 2/2] tools/tests/cpu-policy: disable 
Would you mind clarifying which 12 you mean to change to 13?
The one in "%.12s" would, if changed and afaict, then
legitimately trigger the warning. And we've already objected
to the array to get grown.

I meant the array.  I missed that objection.  I just went and read the
   tests/cpu-policy: fix format-overflow warning by null terminating strings
and it did conclude that the compiler was wrong to complain.

But for me it doesn't follow that the original code is necessarily the
best way of doing things, and I didn't see anyone giving an argument
why simply increasing the array was a bad idea.

C "prefers" null-terminated strings in that they work somewhat better
with a variety of primitives.

Right, but the %.<num>s specification exits precisely to allow
to deal with potentially not nul-terminated strings. ACPI code
in the hypervisor makes quite a bit of use of this, for example,
without triggering any compiler warnings with 9.1.0.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.