Commit fc56878
netfilter: nf_reject: Fix build warning when CONFIG_BRIDGE_NETFILTER=n
If CONFIG_BRIDGE_NETFILTER is not enabled, which is the case for x86_64
defconfig, then building nf_reject_ipv4.c and nf_reject_ipv6.c with W=1
using gcc-14 results in the following warnings, which are treated as
errors:
net/ipv4/netfilter/nf_reject_ipv4.c: In function 'nf_send_reset':
net/ipv4/netfilter/nf_reject_ipv4.c:243:23: error: variable 'niph' set but not used [-Werror=unused-but-set-variable]
243 | struct iphdr *niph;
| ^~~~
cc1: all warnings being treated as errors
net/ipv6/netfilter/nf_reject_ipv6.c: In function 'nf_send_reset6':
net/ipv6/netfilter/nf_reject_ipv6.c:286:25: error: variable 'ip6h' set but not used [-Werror=unused-but-set-variable]
286 | struct ipv6hdr *ip6h;
| ^~~~
cc1: all warnings being treated as errors
Address this by reducing the scope of these local variables to where
they are used, which is code only compiled when CONFIG_BRIDGE_NETFILTER
enabled.
Compile tested and run through netfilter selftests.
Reported-by: Andy Shevchenko <[email protected]>
Closes: https://lore.kernel.org/netfilter-devel/[email protected]/
Signed-off-by: Simon Horman <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>1 parent 642c89c commit fc56878
File tree
2 files changed
+6
-9
lines changed- net
- ipv4/netfilter
- ipv6/netfilter
2 files changed
+6
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
243 | | - | |
244 | 242 | | |
| 243 | + | |
245 | 244 | | |
246 | 245 | | |
247 | 246 | | |
| |||
266 | 265 | | |
267 | 266 | | |
268 | 267 | | |
269 | | - | |
270 | | - | |
| 268 | + | |
| 269 | + | |
271 | 270 | | |
272 | 271 | | |
273 | 272 | | |
274 | 273 | | |
275 | | - | |
276 | | - | |
277 | 274 | | |
278 | 275 | | |
279 | 276 | | |
| |||
290 | 287 | | |
291 | 288 | | |
292 | 289 | | |
| 290 | + | |
293 | 291 | | |
294 | 292 | | |
295 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
287 | 286 | | |
288 | 287 | | |
289 | 288 | | |
| |||
339 | 338 | | |
340 | 339 | | |
341 | 340 | | |
342 | | - | |
343 | | - | |
| 341 | + | |
344 | 342 | | |
345 | 343 | | |
346 | 344 | | |
| |||
355 | 353 | | |
356 | 354 | | |
357 | 355 | | |
| 356 | + | |
358 | 357 | | |
359 | 358 | | |
360 | 359 | | |
| |||
0 commit comments