* [PATCH] nf_conntrack_amanda: fix textsearch_prepare() error check
@ 2007-06-03 12:00 Akinobu Mita
2007-06-04 11:41 ` Patrick McHardy
0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2007-06-03 12:00 UTC (permalink / raw)
To: netfilter-devel; +Cc: Brian J. Murrell
The return value from textsearch_prepare() needs to be checked
by IS_ERR(). Because it returns error code as a pointer.
Cc: "Brian J. Murrell" <netfilter@interlinx.bc.ca>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
net/netfilter/nf_conntrack_amanda.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: 2.6-mm/net/netfilter/nf_conntrack_amanda.c
===================================================================
--- 2.6-mm.orig/net/netfilter/nf_conntrack_amanda.c
+++ 2.6-mm/net/netfilter/nf_conntrack_amanda.c
@@ -208,13 +208,14 @@ static int __init nf_conntrack_amanda_in
{
int ret, i;
- ret = -ENOMEM;
for (i = 0; i < ARRAY_SIZE(search); i++) {
search[i].ts = textsearch_prepare(ts_algo, search[i].string,
search[i].len,
GFP_KERNEL, TS_AUTOLOAD);
- if (search[i].ts == NULL)
+ if (IS_ERR(search[i].ts)) {
+ ret = PTR_ERR(search[i].ts);
goto err1;
+ }
}
ret = nf_conntrack_helper_register(&amanda_helper[0]);
if (ret < 0)
@@ -227,10 +228,9 @@ static int __init nf_conntrack_amanda_in
err2:
nf_conntrack_helper_unregister(&amanda_helper[0]);
err1:
- for (; i >= 0; i--) {
- if (search[i].ts)
- textsearch_destroy(search[i].ts);
- }
+ while (--i >= 0)
+ textsearch_destroy(search[i].ts);
+
return ret;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] nf_conntrack_amanda: fix textsearch_prepare() error check
2007-06-03 12:00 [PATCH] nf_conntrack_amanda: fix textsearch_prepare() error check Akinobu Mita
@ 2007-06-04 11:41 ` Patrick McHardy
0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2007-06-04 11:41 UTC (permalink / raw)
To: Akinobu Mita; +Cc: Brian J. Murrell, netfilter-devel
Akinobu Mita wrote:
> The return value from textsearch_prepare() needs to be checked
> by IS_ERR(). Because it returns error code as a pointer.
Good catch, applied. Thanks Akinobu.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-04 11:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-03 12:00 [PATCH] nf_conntrack_amanda: fix textsearch_prepare() error check Akinobu Mita
2007-06-04 11:41 ` Patrick McHardy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.