Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gcc-15: get rid of misc extra NUL character padding

This removes two cases of explicit NUL padding that now causes warnings
because of '-Wunterminated-string-initialization' being part of -Wextra
in gcc-15.

Gcc is being silly in this case when it says that it truncates a NUL
terminator, because in these cases there were _multiple_ NUL characters.

But we can get rid of the warning by just simplifying the two
initializers that trigger the warning for me, so this does exactly that.

I'm not sure why the power supply code did that odd

.attr_name = #_name "\0",

pattern: it was introduced in commit 2cabeaf15129 ("power: supply: core:
Cleanup power supply sysfs attribute list"), but that 'attr_name[]'
field is an explicitly sized character array in a statically initialized
variable, and a string initializer always has a terminating NUL _and_
statically initialized character arrays are zero-padded anyway, so it
really seems to be rather extraneous belt-and-suspenders.

The zero_uuid[16] initialization in drivers/md/bcache/super.c makes
perfect sense, but it isn't necessary for the same reasons, and not
worth the new gcc warning noise.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+2 -2
+1 -1
drivers/md/bcache/super.c
··· 546 546 547 547 static struct uuid_entry *uuid_find_empty(struct cache_set *c) 548 548 { 549 - static const char zero_uuid[16] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; 549 + static const char zero_uuid[16] = { 0 }; 550 550 551 551 return uuid_find(c, zero_uuid); 552 552 }
+1 -1
drivers/power/supply/power_supply_sysfs.c
··· 33 33 [POWER_SUPPLY_PROP_ ## _name] = \ 34 34 { \ 35 35 .prop_name = #_name, \ 36 - .attr_name = #_name "\0", \ 36 + .attr_name = #_name, \ 37 37 .text_values = _text, \ 38 38 .text_values_len = _len, \ 39 39 }