copy'n'paste like typo in pf.c

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

copy'n'paste like typo in pf.c

Alexandr Nedvedicky
Hello,

when we ran PF sources through coverity we got an error
as follows:

8310           if (ri->r->dst.addr.type == PF_ADDR_TABLE)
8311                       pfr_update_stats(ri->r->dst.addr.p.tbl,
8312                              &s->key[(s->direction == PF_IN)]->
8313                              addr[(s->direction == PF_IN)],

   
CID 38100 (#1 of 1): Copy-paste error (COPY_PASTE_ERROR)copy_paste_error: src
in ri->r->src.neg looks like a copy-paste error.
   
Should it say dst instead?
8314                            pd, ri->r->action, ri->r->src.neg);
8315                        }
8316                }

(note: line numbers won't match line numbers in OpenBSD).

It seems to me coveirty is right. Patch against CURRENT is attached.

kind regards
sasha


--------- cut here to get patch ----------
Warning: Permanently added 'anoncvs.ca.openbsd.org' (ECDSA) to the list of known hosts.
Index: pf.c
===================================================================
RCS file: /cvs/src/sys/net/pf.c,v
retrieving revision 1.909
diff -u -r1.909 pf.c
--- pf.c        18 Mar 2015 12:23:15 -0000      1.909
+++ pf.c        5 Apr 2015 09:46:46 -0000
@@ -6277,7 +6277,7 @@
                                        pfr_update_stats(ri->r->dst.addr.p.tbl,
                                            &s->key[(s->direction == PF_IN)]->
                                                addr[(s->direction == PF_IN)],
-                                           pd, ri->r->action, ri->r->src.neg);
+                                           pd, ri->r->action, ri->r->dst.neg);
                        }
                }
                if (r->src.addr.type == PF_ADDR_TABLE)


pf.c.diff (550 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: copy'n'paste like typo in pf.c

Florian Obser-2
On Sun, Apr 05, 2015 at 11:48:21AM +0200, Alexandr Nedvedicky wrote:

> Hello,
>
> when we ran PF sources through coverity we got an error
> as follows:
>
> 8310           if (ri->r->dst.addr.type == PF_ADDR_TABLE)
> 8311                       pfr_update_stats(ri->r->dst.addr.p.tbl,
> 8312                              &s->key[(s->direction == PF_IN)]->
> 8313                              addr[(s->direction == PF_IN)],
>
>    
> CID 38100 (#1 of 1): Copy-paste error (COPY_PASTE_ERROR)copy_paste_error: src
> in ri->r->src.neg looks like a copy-paste error.
>    
> Should it say dst instead?
> 8314                            pd, ri->r->action, ri->r->src.neg);
> 8315                        }
> 8316                }
>
> (note: line numbers won't match line numbers in OpenBSD).
>
> It seems to me coveirty is right. Patch against CURRENT is attached.
>
> kind regards
> sasha
>
>
> --------- cut here to get patch ----------
> Warning: Permanently added 'anoncvs.ca.openbsd.org' (ECDSA) to the list of known hosts.
> Index: pf.c
> ===================================================================
> RCS file: /cvs/src/sys/net/pf.c,v
> retrieving revision 1.909
> diff -u -r1.909 pf.c
> --- pf.c        18 Mar 2015 12:23:15 -0000      1.909
> +++ pf.c        5 Apr 2015 09:46:46 -0000
> @@ -6277,7 +6277,7 @@
>                                         pfr_update_stats(ri->r->dst.addr.p.tbl,
>                                             &s->key[(s->direction == PF_IN)]->
>                                                 addr[(s->direction == PF_IN)],
> -                                           pd, ri->r->action, ri->r->src.neg);
> +                                           pd, ri->r->action, ri->r->dst.neg);
>                         }
>                 }
>                 if (r->src.addr.type == PF_ADDR_TABLE)
>

> Index: pf.c
> ===================================================================
> RCS file: /cvs/src/sys/net/pf.c,v
> retrieving revision 1.909
> diff -u -r1.909 pf.c
> --- pf.c 18 Mar 2015 12:23:15 -0000 1.909
> +++ pf.c 5 Apr 2015 09:47:18 -0000
> @@ -6277,7 +6277,7 @@
>   pfr_update_stats(ri->r->dst.addr.p.tbl,
>      &s->key[(s->direction == PF_IN)]->
>   addr[(s->direction == PF_IN)],
> -    pd, ri->r->action, ri->r->src.neg);
> +    pd, ri->r->action, ri->r->dst.neg);
>   }
>   }
>   if (r->src.addr.type == PF_ADDR_TABLE)

This looks correct.
OK florian@

--
I'm not entirely sure you are real.

Reply | Threaded
Open this post in threaded view
|

Re: copy'n'paste like typo in pf.c

Mike Belopuhov-5
On 5 April 2015 at 15:14, Florian Obser <[hidden email]> wrote:

> On Sun, Apr 05, 2015 at 11:48:21AM +0200, Alexandr Nedvedicky wrote:
>> Hello,
>>
>> when we ran PF sources through coverity we got an error
>> as follows:
>>
>> 8310           if (ri->r->dst.addr.type == PF_ADDR_TABLE)
>> 8311                       pfr_update_stats(ri->r->dst.addr.p.tbl,
>> 8312                              &s->key[(s->direction == PF_IN)]->
>> 8313                              addr[(s->direction == PF_IN)],
>>
>>
>> CID 38100 (#1 of 1): Copy-paste error (COPY_PASTE_ERROR)copy_paste_error: src
>> in ri->r->src.neg looks like a copy-paste error.
>>
>> Should it say dst instead?
>> 8314                            pd, ri->r->action, ri->r->src.neg);
>> 8315                        }
>> 8316                }
>>
>> (note: line numbers won't match line numbers in OpenBSD).
>>
>> It seems to me coveirty is right. Patch against CURRENT is attached.
>>
>> kind regards
>> sasha
>>
[snip]
>
> This looks correct.
> OK florian@
>

Committed, thanks!