Skip to content

Commit 723eb29

Browse files
gfreewindummakynes
authored andcommitted
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 <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent f0608ce commit 723eb29

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

net/netfilter/nf_conntrack_ftp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,6 @@ static int find_pattern(const char *data, size_t dlen,
301301
size_t i = plen;
302302

303303
pr_debug("find_pattern `%s': dlen = %Zu\n", pattern, dlen);
304-
if (dlen == 0)
305-
return 0;
306304

307305
if (dlen <= plen) {
308306
/* Short packet: try for partial? */

0 commit comments

Comments
 (0)