We can avoid some possible robustness issues with overlapping arguments if we turn -Wrestrict back on. There are only a handful in an x86_64 allmodconfig build, and all appear to be the common "append to a string using sprintf()" idiom that isn't considered good form any more:
drivers/input/joystick/analog.c: In function 'analog_name':
drivers/input/joystick/analog.c:428:3: warning: 'snprintf' argument 4 overlaps destination object 'analog' [-Wrestrict]
428 | snprintf(analog->name, sizeof(analog->name), "%s %d-hat",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
429 | analog->name, hweight16(analog->mask & ANALOG_HATS_ALL));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/input/joystick/analog.c:420:40: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
420 | static void analog_name(struct analog *analog)
| ~~~~~~~~~~~~~~~^~~~~~
drivers/leds/led-class-flash.c: In function 'flash_fault_show':
drivers/leds/led-class-flash.c:212:9: warning: 'sprintf' argument 3 overlaps destination object 'buf' [-Wrestrict]
212 | return sprintf(buf, "%s\n", buf);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/leds/led-class-flash.c:189:40: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
189 | struct device_attribute *attr, char *buf)
| ~~~~~~^~~
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_request_irq_multi_msi':
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3517:3: warning: 'sprintf' argument 3 may overlap destination object 'dev' [-Wrestrict]
3517 | sprintf(int_name, "%s:%s-%d", dev->name, "rx", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3416:60: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
3416 | static int stmmac_request_irq_multi_msi(struct net_device *dev)
| ~~~~~~~~~~~~~~~~~~~^~~
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3540:3: warning: 'sprintf' argument 3 may overlap destination object 'dev' [-Wrestrict]
3540 | sprintf(int_name, "%s:%s-%d", dev->name, "tx", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3416:60: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
3416 | static int stmmac_request_irq_multi_msi(struct net_device *dev)
| ~~~~~~~~~~~~~~~~~~~^~~
drivers/thunderbolt/xdomain.c: In function 'modalias_show':
drivers/thunderbolt/xdomain.c:733:9: warning: 'sprintf' argument 3 overlaps destination object 'buf' [-Wrestrict]
733 | return sprintf(buf, "%s\n", buf);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/thunderbolt/xdomain.c:727:15: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
727 | char *buf)
| ~~~~~~^~~
We can avoid some possible robustness issues with overlapping arguments if we turn
-Wrestrict
back on. There are only a handful in anx86_64 allmodconfig
build, and all appear to be the common "append to a string usingsprintf()
" idiom that isn't considered good form any more: