mirror of
https://github.com/torvalds/linux.git
synced 2025-11-07 03:59:22 +02:00
gcc-7 points out that a negative port_num value would overflow the
string buffer:
drivers/infiniband/hw/mlx4/sysfs.c: In function 'mlx4_ib_device_register_sysfs':
drivers/infiniband/hw/mlx4/sysfs.c:251:16: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
drivers/infiniband/hw/mlx4/sysfs.c:251:2: note: 'sprintf' output between 2 and 11 bytes into a destination of size 10
drivers/infiniband/hw/mlx4/sysfs.c:303:17: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
drivers/infiniband/hw/mlx4/sysfs.c:303:3: note: 'sprintf' output between 2 and 11 bytes into a destination of size 10
While we should be able to assume that port_num is positive here, making
the buffer one byte longer has no downsides and avoids the warning.
Fixes:
|
||
|---|---|---|
| .. | ||
| ah.c | ||
| alias_GUID.c | ||
| cm.c | ||
| cq.c | ||
| doorbell.c | ||
| Kconfig | ||
| mad.c | ||
| main.c | ||
| Makefile | ||
| mcg.c | ||
| mlx4_ib.h | ||
| mr.c | ||
| qp.c | ||
| srq.c | ||
| sysfs.c | ||