Re: net/sctp/socket.c:2681:6-11: ERROR: invalid reference to the index variable of the iterator on line 2661 (fwd)

2018-08-30 Thread Xin Long
On Wed, Aug 29, 2018 at 11:32 PM Julia Lawall  wrote:
>
> Hello,
>
> Are the ifs starting on lines 2655 and 2680 mutually exclusive?  If so,
> perhaps add an else.  If not, and if the trans on line 2681 can come from
> the trans initialized by the loop on line 2661, then there is a problem.
You're right, I will send a fix to add a local trans for
transport_addr_list traversing.
Thanks.

>
> julia
>
> -- Forwarded message --
> Date: Wed, 29 Aug 2018 22:02:39 +0800
> From: kbuild test robot 
> To: kbu...@01.org
> Cc: Julia Lawall 
> Subject: net/sctp/socket.c:2681:6-11: ERROR: invalid reference to the index
> variable of the iterator on line 2661
>
> CC: kbuild-...@01.org
> CC: linux-kernel@vger.kernel.org
> TO: Xin Long 
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   3f16503b7d2274ac8cbab11163047ac0b4c66cfe
> commit: 0b0dce7a36fb9f1a9dd8245ea82d3a268c6943fe sctp: add spp_ipv6_flowlabel 
> and spp_dscp for sctp_paddrparams
> date:   8 weeks ago
> :: branch date: 15 hours ago
> :: commit date: 8 weeks ago
>
> >> net/sctp/socket.c:2681:6-11: ERROR: invalid reference to the index 
> >> variable of the iterator on line 2661
>
> # 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b0dce7a36fb9f1a9dd8245ea82d3a268c6943fe
> git remote add linus 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git remote update linus
> git checkout 0b0dce7a36fb9f1a9dd8245ea82d3a268c6943fe
> vim +2681 net/sctp/socket.c
>
> ^1da177e4 Linus Torvalds  2005-04-16  2378
> ^1da177e4 Linus Torvalds  2005-04-16  2379  /* 7.1.13 Peer Address 
> Parameters (SCTP_PEER_ADDR_PARAMS)
> ^1da177e4 Linus Torvalds  2005-04-16  2380   *
> ^1da177e4 Linus Torvalds  2005-04-16  2381   * Applications can 
> enable or disable heartbeats for any peer address of
> ^1da177e4 Linus Torvalds  2005-04-16  2382   * an association, modify 
> an address's heartbeat interval, force a
> ^1da177e4 Linus Torvalds  2005-04-16  2383   * heartbeat to be sent 
> immediately, and adjust the address's maximum
> ^1da177e4 Linus Torvalds  2005-04-16  2384   * number of 
> retransmissions sent before an address is considered
> ^1da177e4 Linus Torvalds  2005-04-16  2385   * unreachable.  The 
> following structure is used to access and modify an
> ^1da177e4 Linus Torvalds  2005-04-16  2386   * address's parameters:
> ^1da177e4 Linus Torvalds  2005-04-16  2387   *
> ^1da177e4 Linus Torvalds  2005-04-16  2388   *  struct 
> sctp_paddrparams {
> ^1da177e4 Linus Torvalds  2005-04-16  2389   * sctp_assoc_t   
>  spp_assoc_id;
> ^1da177e4 Linus Torvalds  2005-04-16  2390   * struct 
> sockaddr_storage spp_address;
> ^1da177e4 Linus Torvalds  2005-04-16  2391   * uint32_t   
>  spp_hbinterval;
> ^1da177e4 Linus Torvalds  2005-04-16  2392   * uint16_t   
>  spp_pathmaxrxt;
> 52ccb8e90 Frank Filz  2005-12-22  2393   * uint32_t   
>  spp_pathmtu;
> 52ccb8e90 Frank Filz  2005-12-22  2394   * uint32_t   
>  spp_sackdelay;
> 52ccb8e90 Frank Filz  2005-12-22  2395   * uint32_t   
>  spp_flags;
> 0b0dce7a3 Xin Long2018-07-02  2396   * uint32_t   
>  spp_ipv6_flowlabel;
> 0b0dce7a3 Xin Long2018-07-02  2397   * uint8_t
>  spp_dscp;
> ^1da177e4 Linus Torvalds  2005-04-16  2398   * };
> ^1da177e4 Linus Torvalds  2005-04-16  2399   *
> 52ccb8e90 Frank Filz  2005-12-22  2400   *   spp_assoc_id- 
> (one-to-many style socket) This is filled in the
> 52ccb8e90 Frank Filz  2005-12-22  2401   * 
> application, and identifies the association for
> 52ccb8e90 Frank Filz  2005-12-22  2402   * 
> this query.
> ^1da177e4 Linus Torvalds  2005-04-16  2403   *   spp_address - 
> This specifies which address is of interest.
> ^1da177e4 Linus Torvalds  2005-04-16  2404   *   spp_hbinterval  - 
> This contains the value of the heartbeat interval,
> 52ccb8e90 Frank Filz  2005-12-22  2405   * in 
> milliseconds.  If a  value of zero
> 52ccb8e90 Frank Filz  2005-12-22  2406   * is 
> present in this field then no changes are to
> 52ccb8e90 Frank Filz  2005-12-22  2407   * be 
> made to this parameter.
> ^1da177e4 Linus Torvalds  2005-04-16  2408   *   spp_pathmaxrxt  - 
> This contains the maximum number of
> ^1da177e4 Linus Torvalds  2005-04-16  2409   * 
> retransmissions before this address shall be
> 52ccb8e90 Frank Filz  2005-12-22  2410   * 
> considered unreachable. If a  value of zero
> 52cc

net/sctp/socket.c:2681:6-11: ERROR: invalid reference to the index variable of the iterator on line 2661 (fwd)

2018-08-29 Thread Julia Lawall
Hello,

Are the ifs starting on lines 2655 and 2680 mutually exclusive?  If so,
perhaps add an else.  If not, and if the trans on line 2681 can come from
the trans initialized by the loop on line 2661, then there is a problem.

julia

-- Forwarded message --
Date: Wed, 29 Aug 2018 22:02:39 +0800
From: kbuild test robot 
To: kbu...@01.org
Cc: Julia Lawall 
Subject: net/sctp/socket.c:2681:6-11: ERROR: invalid reference to the index
variable of the iterator on line 2661

CC: kbuild-...@01.org
CC: linux-kernel@vger.kernel.org
TO: Xin Long 

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   3f16503b7d2274ac8cbab11163047ac0b4c66cfe
commit: 0b0dce7a36fb9f1a9dd8245ea82d3a268c6943fe sctp: add spp_ipv6_flowlabel 
and spp_dscp for sctp_paddrparams
date:   8 weeks ago
:: branch date: 15 hours ago
:: commit date: 8 weeks ago

>> net/sctp/socket.c:2681:6-11: ERROR: invalid reference to the index variable 
>> of the iterator on line 2661

# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b0dce7a36fb9f1a9dd8245ea82d3a268c6943fe
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout 0b0dce7a36fb9f1a9dd8245ea82d3a268c6943fe
vim +2681 net/sctp/socket.c

^1da177e4 Linus Torvalds  2005-04-16  2378
^1da177e4 Linus Torvalds  2005-04-16  2379  /* 7.1.13 Peer Address 
Parameters (SCTP_PEER_ADDR_PARAMS)
^1da177e4 Linus Torvalds  2005-04-16  2380   *
^1da177e4 Linus Torvalds  2005-04-16  2381   * Applications can enable 
or disable heartbeats for any peer address of
^1da177e4 Linus Torvalds  2005-04-16  2382   * an association, modify 
an address's heartbeat interval, force a
^1da177e4 Linus Torvalds  2005-04-16  2383   * heartbeat to be sent 
immediately, and adjust the address's maximum
^1da177e4 Linus Torvalds  2005-04-16  2384   * number of 
retransmissions sent before an address is considered
^1da177e4 Linus Torvalds  2005-04-16  2385   * unreachable.  The 
following structure is used to access and modify an
^1da177e4 Linus Torvalds  2005-04-16  2386   * address's parameters:
^1da177e4 Linus Torvalds  2005-04-16  2387   *
^1da177e4 Linus Torvalds  2005-04-16  2388   *  struct sctp_paddrparams 
{
^1da177e4 Linus Torvalds  2005-04-16  2389   * sctp_assoc_t 
   spp_assoc_id;
^1da177e4 Linus Torvalds  2005-04-16  2390   * struct 
sockaddr_storage spp_address;
^1da177e4 Linus Torvalds  2005-04-16  2391   * uint32_t 
   spp_hbinterval;
^1da177e4 Linus Torvalds  2005-04-16  2392   * uint16_t 
   spp_pathmaxrxt;
52ccb8e90 Frank Filz  2005-12-22  2393   * uint32_t 
   spp_pathmtu;
52ccb8e90 Frank Filz  2005-12-22  2394   * uint32_t 
   spp_sackdelay;
52ccb8e90 Frank Filz  2005-12-22  2395   * uint32_t 
   spp_flags;
0b0dce7a3 Xin Long2018-07-02  2396   * uint32_t 
   spp_ipv6_flowlabel;
0b0dce7a3 Xin Long2018-07-02  2397   * uint8_t  
   spp_dscp;
^1da177e4 Linus Torvalds  2005-04-16  2398   * };
^1da177e4 Linus Torvalds  2005-04-16  2399   *
52ccb8e90 Frank Filz  2005-12-22  2400   *   spp_assoc_id- 
(one-to-many style socket) This is filled in the
52ccb8e90 Frank Filz  2005-12-22  2401   * 
application, and identifies the association for
52ccb8e90 Frank Filz  2005-12-22  2402   * this 
query.
^1da177e4 Linus Torvalds  2005-04-16  2403   *   spp_address - This 
specifies which address is of interest.
^1da177e4 Linus Torvalds  2005-04-16  2404   *   spp_hbinterval  - This 
contains the value of the heartbeat interval,
52ccb8e90 Frank Filz  2005-12-22  2405   * in 
milliseconds.  If a  value of zero
52ccb8e90 Frank Filz  2005-12-22  2406   * is 
present in this field then no changes are to
52ccb8e90 Frank Filz  2005-12-22  2407   * be 
made to this parameter.
^1da177e4 Linus Torvalds  2005-04-16  2408   *   spp_pathmaxrxt  - This 
contains the maximum number of
^1da177e4 Linus Torvalds  2005-04-16  2409   * 
retransmissions before this address shall be
52ccb8e90 Frank Filz  2005-12-22  2410   * 
considered unreachable. If a  value of zero
52ccb8e90 Frank Filz  2005-12-22  2411   * is 
present in this field then no changes are to
52ccb8e90 Frank Filz  2005-12-22  2412   * be 
made to this parameter.
52ccb8e90 Frank Filz  2005-12-22  2413   *   spp_pathmtu - When 
Path MTU discovery is disabled the value
52c