linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] sctp: declare struct sctp_stream before using it
@ 2017-03-20  9:46 Xin Long
  2017-03-20 13:29 ` Neil Horman
  2017-03-22 17:58 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Xin Long @ 2017-03-20  9:46 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: davem, Marcelo Ricardo Leitner, Neil Horman

sctp_stream_free uses struct sctp_stream as a param, but struct sctp_stream
is defined after it's declaration.

This patch is to declare struct sctp_stream before sctp_stream_free.

Fixes: a83863174a61 ("sctp: prepare asoc stream for stream reconf")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/net/sctp/structs.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 4f64519..592dece 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -83,6 +83,7 @@ struct sctp_bind_addr;
 struct sctp_ulpq;
 struct sctp_ep_common;
 struct crypto_shash;
+struct sctp_stream;
 
 
 #include <net/sctp/tsnmap.h>
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] sctp: declare struct sctp_stream before using it
  2017-03-20  9:46 [PATCH net] sctp: declare struct sctp_stream before using it Xin Long
@ 2017-03-20 13:29 ` Neil Horman
  2017-03-20 14:33   ` Xin Long
  2017-03-22 17:58 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Neil Horman @ 2017-03-20 13:29 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner

On Mon, Mar 20, 2017 at 05:46:27PM +0800, Xin Long wrote:
> sctp_stream_free uses struct sctp_stream as a param, but struct sctp_stream
> is defined after it's declaration.
> 
> This patch is to declare struct sctp_stream before sctp_stream_free.
> 
> Fixes: a83863174a61 ("sctp: prepare asoc stream for stream reconf")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  include/net/sctp/structs.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
> index 4f64519..592dece 100644
> --- a/include/net/sctp/structs.h
> +++ b/include/net/sctp/structs.h
> @@ -83,6 +83,7 @@ struct sctp_bind_addr;
>  struct sctp_ulpq;
>  struct sctp_ep_common;
>  struct crypto_shash;
> +struct sctp_stream;
>  
>  
>  #include <net/sctp/tsnmap.h>
> -- 
> 2.1.0
> 
> 

Not sure I follow.  did we run into a compilation failure here?

Neil


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] sctp: declare struct sctp_stream before using it
  2017-03-20 13:29 ` Neil Horman
@ 2017-03-20 14:33   ` Xin Long
  2017-03-21 11:36     ` Neil Horman
  0 siblings, 1 reply; 5+ messages in thread
From: Xin Long @ 2017-03-20 14:33 UTC (permalink / raw)
  To: Neil Horman; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner

On Mon, Mar 20, 2017 at 9:29 PM, Neil Horman <nhorman@tuxdriver.com> wrote:
> On Mon, Mar 20, 2017 at 05:46:27PM +0800, Xin Long wrote:
>> sctp_stream_free uses struct sctp_stream as a param, but struct sctp_stream
>> is defined after it's declaration.
>>
>> This patch is to declare struct sctp_stream before sctp_stream_free.
>>
>> Fixes: a83863174a61 ("sctp: prepare asoc stream for stream reconf")
>> Signed-off-by: Xin Long <lucien.xin@gmail.com>
>> ---
>>  include/net/sctp/structs.h | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
>> index 4f64519..592dece 100644
>> --- a/include/net/sctp/structs.h
>> +++ b/include/net/sctp/structs.h
>> @@ -83,6 +83,7 @@ struct sctp_bind_addr;
>>  struct sctp_ulpq;
>>  struct sctp_ep_common;
>>  struct crypto_shash;
>> +struct sctp_stream;
>>
>>
>>  #include <net/sctp/tsnmap.h>
>> --
>> 2.1.0
>>
>>
>
> Not sure I follow.  did we run into a compilation failure here?
no compilation err was found, even now.

because of
struct sctp_stream *sctp_stream_new(__u16 incnt, __u16 outcnt, gfp_t gfp);
void sctp_stream_free(struct sctp_stream *stream);

I'm not sure why gcc did not complain, but when I moved sctp_stream_new
below sctp_stream_free:
void sctp_stream_free(struct sctp_stream *stream);
struct sctp_stream *sctp_stream_new(__u16 incnt, __u16 outcnt, gfp_t gfp);

the err showed up.

So the better thing we should do is to declare struct sctp_stream to
avoid this potential issue.

Besides, I'm planing to change the return value type of sctp_stream_new.
after which, the issue will be exposed.

>
> Neil
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] sctp: declare struct sctp_stream before using it
  2017-03-20 14:33   ` Xin Long
@ 2017-03-21 11:36     ` Neil Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Horman @ 2017-03-21 11:36 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner

On Mon, Mar 20, 2017 at 10:33:57PM +0800, Xin Long wrote:
> On Mon, Mar 20, 2017 at 9:29 PM, Neil Horman <nhorman@tuxdriver.com> wrote:
> > On Mon, Mar 20, 2017 at 05:46:27PM +0800, Xin Long wrote:
> >> sctp_stream_free uses struct sctp_stream as a param, but struct sctp_stream
> >> is defined after it's declaration.
> >>
> >> This patch is to declare struct sctp_stream before sctp_stream_free.
> >>
> >> Fixes: a83863174a61 ("sctp: prepare asoc stream for stream reconf")
> >> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> >> ---
> >>  include/net/sctp/structs.h | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
> >> index 4f64519..592dece 100644
> >> --- a/include/net/sctp/structs.h
> >> +++ b/include/net/sctp/structs.h
> >> @@ -83,6 +83,7 @@ struct sctp_bind_addr;
> >>  struct sctp_ulpq;
> >>  struct sctp_ep_common;
> >>  struct crypto_shash;
> >> +struct sctp_stream;
> >>
> >>
> >>  #include <net/sctp/tsnmap.h>
> >> --
> >> 2.1.0
> >>
> >>
> >
> > Not sure I follow.  did we run into a compilation failure here?
> no compilation err was found, even now.
> 
> because of
> struct sctp_stream *sctp_stream_new(__u16 incnt, __u16 outcnt, gfp_t gfp);
> void sctp_stream_free(struct sctp_stream *stream);
> 
> I'm not sure why gcc did not complain, but when I moved sctp_stream_new
> below sctp_stream_free:
> void sctp_stream_free(struct sctp_stream *stream);
> struct sctp_stream *sctp_stream_new(__u16 incnt, __u16 outcnt, gfp_t gfp);
> 
> the err showed up.
> 
odd, its almost like gcc considered the return value of sctp_stream_new to be a
forward declaration of the struct.

Anywho, can't hurt to make this chagne
Acked-by: Neil Horman <nhorman@tuxdriver.com>

> So the better thing we should do is to declare struct sctp_stream to
> avoid this potential issue.
> 
> Besides, I'm planing to change the return value type of sctp_stream_new.
> after which, the issue will be exposed.
> 
> >
> > Neil
> >
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] sctp: declare struct sctp_stream before using it
  2017-03-20  9:46 [PATCH net] sctp: declare struct sctp_stream before using it Xin Long
  2017-03-20 13:29 ` Neil Horman
@ 2017-03-22 17:58 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2017-03-22 17:58 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman

From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 20 Mar 2017 17:46:27 +0800

> sctp_stream_free uses struct sctp_stream as a param, but struct sctp_stream
> is defined after it's declaration.
> 
> This patch is to declare struct sctp_stream before sctp_stream_free.
> 
> Fixes: a83863174a61 ("sctp: prepare asoc stream for stream reconf")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-22 17:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-20  9:46 [PATCH net] sctp: declare struct sctp_stream before using it Xin Long
2017-03-20 13:29 ` Neil Horman
2017-03-20 14:33   ` Xin Long
2017-03-21 11:36     ` Neil Horman
2017-03-22 17:58 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).