]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: ftp: Remove the useless dlen==0 condition check in find_pattern
authorGao Feng <fgao@ikuai8.com>
Thu, 1 Sep 2016 10:58:29 +0000 (18:58 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 7 Sep 2016 08:37:59 +0000 (10:37 +0200)
commit8a02e7a5e98cd35ac436fe583a762a0a89ab800b
tree9a59101dd3f37fd34f6164b777a02143740ed245
parentcbc19ea5bb749420d6cb9916c24eb13f0cc02961
netfilter: ftp: Remove the useless dlen==0 condition check in find_pattern

The caller function "help" has already make sure the datalen could not be zero
before invoke find_pattern as a parameter by the following codes

        if (dataoff >= skb->len) {
                pr_debug("ftp: dataoff(%u) >= skblen(%u)\n", dataoff,
                         skb->len);
                return NF_ACCEPT;
        }
        datalen = skb->len - dataoff;

And the latter codes "ends_in_nl = (fb_ptr[datalen - 1] == '\n');" use datalen
directly without checking if it is zero.

So it is unneccessary to check it in find_pattern too.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_ftp.c