Skip to content

Commit 85bc3f3

Browse files
author
Jan Engelhardt
committed
netfilter: xtables: do not print any messages on ENOMEM
ENOMEM is a very obvious error code (cf. EINVAL), so I think we do not really need a warning message. Not to mention that if the allocation fails, the user is most likely going to get a stack trace from slab already. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
1 parent f5c511c commit 85bc3f3

4 files changed

Lines changed: 6 additions & 17 deletions

File tree

‎net/bridge/netfilter/ebt_ulog.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,10 @@ static int __init ebt_ulog_init(void)
305305
ebtulognl = netlink_kernel_create(&init_net, NETLINK_NFLOG,
306306
EBT_ULOG_MAXNLGROUPS, NULL, NULL,
307307
THIS_MODULE);
308-
if (!ebtulognl) {
309-
printk(KERN_WARNING KBUILD_MODNAME ": out of memory trying to "
310-
"call netlink_kernel_create\n");
308+
if (!ebtulognl)
311309
ret = -ENOMEM;
312-
} else if ((ret = xt_register_target(&ebt_ulog_tg_reg)) != 0) {
310+
else if ((ret = xt_register_target(&ebt_ulog_tg_reg)) != 0)
313311
netlink_kernel_release(ebtulognl);
314-
}
315312

316313
if (ret == 0)
317314
nf_log_register(NFPROTO_BRIDGE, &ebt_ulog_logger);

‎net/netfilter/xt_LED.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,8 @@ static bool led_tg_check(const struct xt_tgchk_param *par)
9292
}
9393

9494
ledinternal = kzalloc(sizeof(struct xt_led_info_internal), GFP_KERNEL);
95-
if (!ledinternal) {
96-
printk(KERN_CRIT KBUILD_MODNAME ": out of memory\n");
95+
if (!ledinternal)
9796
return false;
98-
}
9997

10098
ledinternal->netfilter_led_trigger.name = ledinfo->id;
10199

‎net/netfilter/xt_hashlimit.c‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,8 @@ static int htable_create_v0(struct net *net, struct xt_hashlimit_info *minfo, u_
215215
/* FIXME: don't use vmalloc() here or anywhere else -HW */
216216
hinfo = vmalloc(sizeof(struct xt_hashlimit_htable) +
217217
sizeof(struct list_head) * size);
218-
if (!hinfo) {
219-
printk(KERN_ERR "xt_hashlimit: unable to create hashtable\n");
218+
if (!hinfo)
220219
return -1;
221-
}
222220
minfo->hinfo = hinfo;
223221

224222
/* copy match config into hashtable config */
@@ -288,10 +286,8 @@ static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo,
288286
/* FIXME: don't use vmalloc() here or anywhere else -HW */
289287
hinfo = vmalloc(sizeof(struct xt_hashlimit_htable) +
290288
sizeof(struct list_head) * size);
291-
if (hinfo == NULL) {
292-
printk(KERN_ERR "xt_hashlimit: unable to create hashtable\n");
289+
if (hinfo == NULL)
293290
return -1;
294-
}
295291
minfo->hinfo = hinfo;
296292

297293
/* copy match config into hashtable config */

‎net/netfilter/xt_statistic.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ static bool statistic_mt_check(const struct xt_mtchk_param *par)
6161
return false;
6262

6363
info->master = kzalloc(sizeof(*info->master), GFP_KERNEL);
64-
if (info->master == NULL) {
65-
printk(KERN_ERR KBUILD_MODNAME ": Out of memory\n");
64+
if (info->master == NULL)
6665
return false;
67-
}
6866
info->master->count = info->u.nth.count;
6967

7068
return true;

0 commit comments

Comments
 (0)