linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace: events: fix  error directive in argument list
@ 2019-03-25 19:53 Hariprasad Kelam
  2019-03-25 20:11 ` Steven Rostedt
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Hariprasad Kelam @ 2019-03-25 19:53 UTC (permalink / raw)
  To: rostedt, mingo, roopa, davem, linux-kernel

This patch fixes below spare errors.

Sparse error:
make C=2 CF=-D__CHECK_ENDIAN__ M=net/core
./include/trace/events/neigh.h:73:1: error: directive in argument list
./include/trace/events/neigh.h:78:1: error: directive in argument list
./include/trace/events/neigh.h:150:1: error: directive in argument list
./include/trace/events/neigh.h:155:1: error: directive in argument list

Changes below two lines to signle line to avoid sparse error
 #if IS_ENABLED(CONFIG_IPV6)
               if (n->tbl->family == AF_INET6) {
to if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)

and removes reassigning pin6 pointer when IPV6 is enabled

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
 include/trace/events/neigh.h | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h
index 0bdb085..6e310ea 100644
--- a/include/trace/events/neigh.h
+++ b/include/trace/events/neigh.h
@@ -70,15 +70,11 @@ TRACE_EVENT(neigh_update,
 		else
 			*p32 = 0;
 
-#if IS_ENABLED(CONFIG_IPV6)
-		if (n->tbl->family == AF_INET6) {
-			pin6 = (struct in6_addr *)__entry->primary_key6;
+		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
 			*pin6 = *(struct in6_addr *)n->primary_key;
-		} else
-#endif
-		{
+		else
 			ipv6_addr_set_v4mapped(*p32, pin6);
-		}
+
 		__entry->confirmed = n->confirmed;
 		__entry->updated = n->updated;
 		__entry->used = n->used;
@@ -147,15 +143,10 @@ DECLARE_EVENT_CLASS(neigh__update,
 		else
 			*p32 = 0;
 
-#if IS_ENABLED(CONFIG_IPV6)
-		if (n->tbl->family == AF_INET6) {
-			pin6 = (struct in6_addr *)__entry->primary_key6;
+		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
 			*pin6 = *(struct in6_addr *)n->primary_key;
-		} else
-#endif
-		{
+		else
 			ipv6_addr_set_v4mapped(*p32, pin6);
-		}
 
 		__entry->confirmed = n->confirmed;
 		__entry->updated = n->updated;
-- 
2.7.4


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

* Re: [PATCH] trace: events: fix  error directive in argument list
  2019-03-25 19:53 [PATCH] trace: events: fix error directive in argument list Hariprasad Kelam
@ 2019-03-25 20:11 ` Steven Rostedt
  2019-03-27  0:20   ` Roopa Prabhu
  2019-03-27  0:19 ` Roopa Prabhu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Steven Rostedt @ 2019-03-25 20:11 UTC (permalink / raw)
  To: Hariprasad Kelam; +Cc: mingo, roopa, davem, linux-kernel

On Tue, 26 Mar 2019 01:23:03 +0530
Hariprasad Kelam <hariprasad.kelam@gmail.com> wrote:


> ---
>  include/trace/events/neigh.h | 19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h
> index 0bdb085..6e310ea 100644
> --- a/include/trace/events/neigh.h
> +++ b/include/trace/events/neigh.h
> @@ -70,15 +70,11 @@ TRACE_EVENT(neigh_update,
>  		else
>  			*p32 = 0;
>  
> -#if IS_ENABLED(CONFIG_IPV6)
> -		if (n->tbl->family == AF_INET6) {
> -			pin6 = (struct in6_addr *)__entry->primary_key6;
> +		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
>  			*pin6 = *(struct in6_addr *)n->primary_key;
> -		} else
> -#endif
> -		{
> +		else
>  			ipv6_addr_set_v4mapped(*p32, pin6);
> -		}
> +
>  		__entry->confirmed = n->confirmed;
>  		__entry->updated = n->updated;
>  		__entry->used = n->used;

Not sure why the added pin6 assignment was there to begin with:

<code-snippet>
                pin6 = (struct in6_addr *)__entry->primary_key6;
                p32 = (__be32 *)__entry->primary_key4;

                if (n->tbl->family == AF_INET)
                        *p32 = *(__be32 *)n->primary_key;
                else
                        *p32 = 0;

#if IS_ENABLED(CONFIG_IPV6)
                if (n->tbl->family == AF_INET6) {
                        pin6 = (struct in6_addr *)__entry->primary_key6;
                        *pin6 = *(struct in6_addr *)n->primary_key;
                } else
#endif
                {
                        ipv6_addr_set_v4mapped(*p32, pin6);
                }
</code-snippet>

It was already assigned. Looks fine to me, at least from a tracing
point of view.

-- Steve

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

* Re: [PATCH] trace: events: fix error directive in argument list
  2019-03-25 19:53 [PATCH] trace: events: fix error directive in argument list Hariprasad Kelam
  2019-03-25 20:11 ` Steven Rostedt
@ 2019-03-27  0:19 ` Roopa Prabhu
  2019-03-27 15:53 ` Steven Rostedt
  2019-03-29 23:22 ` Luc Van Oostenryck
  3 siblings, 0 replies; 11+ messages in thread
From: Roopa Prabhu @ 2019-03-27  0:19 UTC (permalink / raw)
  To: Hariprasad Kelam; +Cc: rostedt, mingo, David Miller, Linux Kernel Mailing List

On Mon, Mar 25, 2019 at 12:53 PM Hariprasad Kelam
<hariprasad.kelam@gmail.com> wrote:
>
> This patch fixes below spare errors.
>
> Sparse error:
> make C=2 CF=-D__CHECK_ENDIAN__ M=net/core
> ./include/trace/events/neigh.h:73:1: error: directive in argument list
> ./include/trace/events/neigh.h:78:1: error: directive in argument list
> ./include/trace/events/neigh.h:150:1: error: directive in argument list
> ./include/trace/events/neigh.h:155:1: error: directive in argument list
>
> Changes below two lines to signle line to avoid sparse error
>  #if IS_ENABLED(CONFIG_IPV6)
>                if (n->tbl->family == AF_INET6) {
> to if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
>
> and removes reassigning pin6 pointer when IPV6 is enabled
>
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>

Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>

Thanks!

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

* Re: [PATCH] trace: events: fix error directive in argument list
  2019-03-25 20:11 ` Steven Rostedt
@ 2019-03-27  0:20   ` Roopa Prabhu
  0 siblings, 0 replies; 11+ messages in thread
From: Roopa Prabhu @ 2019-03-27  0:20 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Hariprasad Kelam, mingo, David Miller, Linux Kernel Mailing List

On Mon, Mar 25, 2019 at 1:11 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Tue, 26 Mar 2019 01:23:03 +0530
> Hariprasad Kelam <hariprasad.kelam@gmail.com> wrote:
>
>
> > ---
> >  include/trace/events/neigh.h | 19 +++++--------------
> >  1 file changed, 5 insertions(+), 14 deletions(-)
> >
> > diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h
> > index 0bdb085..6e310ea 100644
> > --- a/include/trace/events/neigh.h
> > +++ b/include/trace/events/neigh.h
> > @@ -70,15 +70,11 @@ TRACE_EVENT(neigh_update,
> >               else
> >                       *p32 = 0;
> >
> > -#if IS_ENABLED(CONFIG_IPV6)
> > -             if (n->tbl->family == AF_INET6) {
> > -                     pin6 = (struct in6_addr *)__entry->primary_key6;
> > +             if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
> >                       *pin6 = *(struct in6_addr *)n->primary_key;
> > -             } else
> > -#endif
> > -             {
> > +             else
> >                       ipv6_addr_set_v4mapped(*p32, pin6);
> > -             }
> > +
> >               __entry->confirmed = n->confirmed;
> >               __entry->updated = n->updated;
> >               __entry->used = n->used;
>
> Not sure why the added pin6 assignment was there to begin with:
>
> <code-snippet>
>                 pin6 = (struct in6_addr *)__entry->primary_key6;
>                 p32 = (__be32 *)__entry->primary_key4;
>
>                 if (n->tbl->family == AF_INET)
>                         *p32 = *(__be32 *)n->primary_key;
>                 else
>                         *p32 = 0;
>
> #if IS_ENABLED(CONFIG_IPV6)
>                 if (n->tbl->family == AF_INET6) {
>                         pin6 = (struct in6_addr *)__entry->primary_key6;
>                         *pin6 = *(struct in6_addr *)n->primary_key;
>                 } else
> #endif
>                 {
>                         ipv6_addr_set_v4mapped(*p32, pin6);
>                 }
> </code-snippet>
>
> It was already assigned. Looks fine to me, at least from a tracing
> point of view.

yes, agree. I will send a follow up patch to remove the redundant pin6
assignment.

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

* Re: [PATCH] trace: events: fix  error directive in argument list
  2019-03-25 19:53 [PATCH] trace: events: fix error directive in argument list Hariprasad Kelam
  2019-03-25 20:11 ` Steven Rostedt
  2019-03-27  0:19 ` Roopa Prabhu
@ 2019-03-27 15:53 ` Steven Rostedt
  2019-03-29 23:12   ` Luc Van Oostenryck
  2019-03-29 23:22 ` Luc Van Oostenryck
  3 siblings, 1 reply; 11+ messages in thread
From: Steven Rostedt @ 2019-03-27 15:53 UTC (permalink / raw)
  To: Hariprasad Kelam; +Cc: mingo, roopa, davem, linux-kernel

On Tue, 26 Mar 2019 01:23:03 +0530
Hariprasad Kelam <hariprasad.kelam@gmail.com> wrote:

> This patch fixes below spare errors.
> 
> Sparse error:
> make C=2 CF=-D__CHECK_ENDIAN__ M=net/core
> ./include/trace/events/neigh.h:73:1: error: directive in argument list
> ./include/trace/events/neigh.h:78:1: error: directive in argument list
> ./include/trace/events/neigh.h:150:1: error: directive in argument list
> ./include/trace/events/neigh.h:155:1: error: directive in argument list
> 

I have nothing really against these patches, but why is the current
code considered wrong?

Note, TRACE_EVENTS() are "special macros". They hold structure
definitions and full code inside the argument list. There should be no
reason that this is causing a warning.

Perhaps we should blacklist the include/trace directory from sparse
checking for these types of "errors".

-- Steve


> Changes below two lines to signle line to avoid sparse error
>  #if IS_ENABLED(CONFIG_IPV6)
>                if (n->tbl->family == AF_INET6) {
> to if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
> 
> and removes reassigning pin6 pointer when IPV6 is enabled
> 
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> ---
>  include/trace/events/neigh.h | 19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h
> index 0bdb085..6e310ea 100644
> --- a/include/trace/events/neigh.h
> +++ b/include/trace/events/neigh.h
> @@ -70,15 +70,11 @@ TRACE_EVENT(neigh_update,
>  		else
>  			*p32 = 0;
>  
> -#if IS_ENABLED(CONFIG_IPV6)
> -		if (n->tbl->family == AF_INET6) {
> -			pin6 = (struct in6_addr *)__entry->primary_key6;
> +		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
>  			*pin6 = *(struct in6_addr *)n->primary_key;
> -		} else
> -#endif
> -		{
> +		else
>  			ipv6_addr_set_v4mapped(*p32, pin6);
> -		}
> +
>  		__entry->confirmed = n->confirmed;
>  		__entry->updated = n->updated;
>  		__entry->used = n->used;
> @@ -147,15 +143,10 @@ DECLARE_EVENT_CLASS(neigh__update,
>  		else
>  			*p32 = 0;
>  
> -#if IS_ENABLED(CONFIG_IPV6)
> -		if (n->tbl->family == AF_INET6) {
> -			pin6 = (struct in6_addr *)__entry->primary_key6;
> +		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
>  			*pin6 = *(struct in6_addr *)n->primary_key;
> -		} else
> -#endif
> -		{
> +		else
>  			ipv6_addr_set_v4mapped(*p32, pin6);
> -		}
>  
>  		__entry->confirmed = n->confirmed;
>  		__entry->updated = n->updated;


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

* Re: [PATCH] trace: events: fix  error directive in argument list
  2019-03-27 15:53 ` Steven Rostedt
@ 2019-03-29 23:12   ` Luc Van Oostenryck
  0 siblings, 0 replies; 11+ messages in thread
From: Luc Van Oostenryck @ 2019-03-29 23:12 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Hariprasad Kelam, mingo, roopa, davem, linux-kernel, linux-sparse

On Wed, Mar 27, 2019 at 11:53:30AM -0400, Steven Rostedt wrote:
> On Tue, 26 Mar 2019 01:23:03 +0530
> Hariprasad Kelam <hariprasad.kelam@gmail.com> wrote:
> 
> > This patch fixes below spare errors.
> > 
> > Sparse error:
> > make C=2 CF=-D__CHECK_ENDIAN__ M=net/core
> > ./include/trace/events/neigh.h:73:1: error: directive in argument list
> > ./include/trace/events/neigh.h:78:1: error: directive in argument list
> > ./include/trace/events/neigh.h:150:1: error: directive in argument list
> > ./include/trace/events/neigh.h:155:1: error: directive in argument list
> > 
> 
> I have nothing really against these patches, but why is the current
> code considered wrong?
> 
> Note, TRACE_EVENTS() are "special macros". They hold structure
> definitions and full code inside the argument list. There should be no
> reason that this is causing a warning.

The problem is that #ifdefs at line 73 & 150 are inside TRACE_EVENT()'s
invocation and this is undefined behaviour. From the standard:
	... If there are sequences of preprocessing tokens within the
	list of arguments that would otherwise act as preprocessing
	directives, the behavior is undefined. 

	[C90 6.8.3, C99 & C11 6.10.3p11]

GCC can handle it (and sparse too) but yes sparse complains about it.

-- Luc Van Oostenryck

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

* Re: [PATCH] trace: events: fix  error directive in argument list
  2019-03-25 19:53 [PATCH] trace: events: fix error directive in argument list Hariprasad Kelam
                   ` (2 preceding siblings ...)
  2019-03-27 15:53 ` Steven Rostedt
@ 2019-03-29 23:22 ` Luc Van Oostenryck
  2019-03-30 11:07   ` Hariprasad Kelam
  3 siblings, 1 reply; 11+ messages in thread
From: Luc Van Oostenryck @ 2019-03-29 23:22 UTC (permalink / raw)
  To: Hariprasad Kelam; +Cc: rostedt, mingo, roopa, davem, linux-kernel

On Tue, Mar 26, 2019 at 01:23:03AM +0530, Hariprasad Kelam wrote:
> This patch fixes below spare errors.
> 
> Sparse error:
> make C=2 CF=-D__CHECK_ENDIAN__ M=net/core
> ./include/trace/events/neigh.h:73:1: error: directive in argument list
> ./include/trace/events/neigh.h:78:1: error: directive in argument list
> ./include/trace/events/neigh.h:150:1: error: directive in argument list
> ./include/trace/events/neigh.h:155:1: error: directive in argument list
> 
> Changes below two lines to signle line to avoid sparse error
>  #if IS_ENABLED(CONFIG_IPV6)
>                if (n->tbl->family == AF_INET6) {
> to if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
> 
> and removes reassigning pin6 pointer when IPV6 is enabled
> 
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> ---
>  include/trace/events/neigh.h | 19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h
> index 0bdb085..6e310ea 100644
> --- a/include/trace/events/neigh.h
> +++ b/include/trace/events/neigh.h
> @@ -70,15 +70,11 @@ TRACE_EVENT(neigh_update,
>  		else
>  			*p32 = 0;
>  
> -#if IS_ENABLED(CONFIG_IPV6)
> -		if (n->tbl->family == AF_INET6) {
> -			pin6 = (struct in6_addr *)__entry->primary_key6;
> +		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
>  			*pin6 = *(struct in6_addr *)n->primary_key;

Why removing the line wheer pin6 is assigned?
IMO, the patch should be:
-#if IS_ENABLED(CONFIG_IPV6)
-		if (n->tbl->family == AF_INET6) {
+		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
 			pin6 = (struct in6_addr *)__entry->primary_key6;
  			*pin6 = *(struct in6_addr *)n->primary_key;

> @@ -147,15 +143,10 @@ DECLARE_EVENT_CLASS(neigh__update,
>  		else
>  			*p32 = 0;
>  
> -#if IS_ENABLED(CONFIG_IPV6)
> -		if (n->tbl->family == AF_INET6) {
> -			pin6 = (struct in6_addr *)__entry->primary_key6;

Same here.

-- Luc Van Oostenryck

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

* Re: [PATCH] trace: events: fix  error directive in argument list
  2019-03-29 23:22 ` Luc Van Oostenryck
@ 2019-03-30 11:07   ` Hariprasad Kelam
  2019-03-30 12:01     ` Luc Van Oostenryck
  0 siblings, 1 reply; 11+ messages in thread
From: Hariprasad Kelam @ 2019-03-30 11:07 UTC (permalink / raw)
  To: Luc Van Oostenryck, Steven Rostedt, mingo, roopa, davem,
	linux-kernel, linux-sparse

On Sat, Mar 30, 2019 at 12:22:17AM +0100, Luc Van Oostenryck wrote:
> On Tue, Mar 26, 2019 at 01:23:03AM +0530, Hariprasad Kelam wrote:
> > This patch fixes below spare errors.
> > 
> > Sparse error:
> > make C=2 CF=-D__CHECK_ENDIAN__ M=net/core
> > ./include/trace/events/neigh.h:73:1: error: directive in argument list
> > ./include/trace/events/neigh.h:78:1: error: directive in argument list
> > ./include/trace/events/neigh.h:150:1: error: directive in argument list
> > ./include/trace/events/neigh.h:155:1: error: directive in argument list
> > 
> > Changes below two lines to signle line to avoid sparse error
> >  #if IS_ENABLED(CONFIG_IPV6)
> >                if (n->tbl->family == AF_INET6) {
> > to if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
> > 
> > and removes reassigning pin6 pointer when IPV6 is enabled
> > 
> > Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> > ---
> >  include/trace/events/neigh.h | 19 +++++--------------
> >  1 file changed, 5 insertions(+), 14 deletions(-)
> > 
> > diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h
> > index 0bdb085..6e310ea 100644
> > --- a/include/trace/events/neigh.h
> > +++ b/include/trace/events/neigh.h
> > @@ -70,15 +70,11 @@ TRACE_EVENT(neigh_update,
> >  		else
> >  			*p32 = 0;
> >  
> > -#if IS_ENABLED(CONFIG_IPV6)
> > -		if (n->tbl->family == AF_INET6) {
> > -			pin6 = (struct in6_addr *)__entry->primary_key6;
> > +		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
> >  			*pin6 = *(struct in6_addr *)n->primary_key;
> 
> Why removing the line wheer pin6 is assigned?
> IMO, the patch should be:
> -#if IS_ENABLED(CONFIG_IPV6)
> -		if (n->tbl->family == AF_INET6) {
> +		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
>  			pin6 = (struct in6_addr *)__entry->primary_key6;
>   			*pin6 = *(struct in6_addr *)n->primary_key;
> 
> > @@ -147,15 +143,10 @@ DECLARE_EVENT_CLASS(neigh__update,
> >  		else
> >  			*p32 = 0;
> >  
> > -#if IS_ENABLED(CONFIG_IPV6)
> > -		if (n->tbl->family == AF_INET6) {
> > -			pin6 = (struct in6_addr *)__entry->primary_key6;
>
pin6  is already assinged .Assinging pin6 is redudant in if loop
 Below is the original code
 <code-snippet>
		pin6 = (struct in6_addr *)__entry->primary_key6;
		p32 = (__be32 *)__entry->primary_key4;

		if (n->tbl->family == AF_INET)
			*p32 = *(__be32 *)n->primary_key;
		else
			*p32 = 0;

#if IS_ENABLED(CONFIG_IPV6)
		if (n->tbl->family == AF_INET6) {
                       pin6 = (struct in6_addr *)__entry->primary_key6;
		       *pin6 = *(struct in6_addr *)n->primary_key;
		} else
#endif
                {
			ipv6_addr_set_v4mapped(*p32, pin6);
		}
 </code-snippet>


> Same here.
> 
> -- Luc Van Oostenryck

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

* Re: [PATCH] trace: events: fix  error directive in argument list
  2019-03-30 11:07   ` Hariprasad Kelam
@ 2019-03-30 12:01     ` Luc Van Oostenryck
  2019-03-30 12:40       ` Steven Rostedt
  0 siblings, 1 reply; 11+ messages in thread
From: Luc Van Oostenryck @ 2019-03-30 12:01 UTC (permalink / raw)
  To: Hariprasad Kelam
  Cc: Steven Rostedt, mingo, roopa, davem, linux-kernel, linux-sparse

On Sat, Mar 30, 2019 at 04:37:48PM +0530, Hariprasad Kelam wrote:
> On Sat, Mar 30, 2019 at 12:22:17AM +0100, Luc Van Oostenryck wrote:
> > On Tue, Mar 26, 2019 at 01:23:03AM +0530, Hariprasad Kelam wrote:
> > > This patch fixes below spare errors.
> > > 
> > > Sparse error:
> > > make C=2 CF=-D__CHECK_ENDIAN__ M=net/core
> > > ./include/trace/events/neigh.h:73:1: error: directive in argument list
> > > ./include/trace/events/neigh.h:78:1: error: directive in argument list
> > > ./include/trace/events/neigh.h:150:1: error: directive in argument list
> > > ./include/trace/events/neigh.h:155:1: error: directive in argument list
> > > 
> > > Changes below two lines to signle line to avoid sparse error
> > >  #if IS_ENABLED(CONFIG_IPV6)
> > >                if (n->tbl->family == AF_INET6) {
> > > to if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
> > > 
> > > and removes reassigning pin6 pointer when IPV6 is enabled
> > > 
> > > Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> > > ---
> > >  include/trace/events/neigh.h | 19 +++++--------------
> > >  1 file changed, 5 insertions(+), 14 deletions(-)
> > > 
> > > diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h
> > > index 0bdb085..6e310ea 100644
> > > --- a/include/trace/events/neigh.h
> > > +++ b/include/trace/events/neigh.h
> > > @@ -70,15 +70,11 @@ TRACE_EVENT(neigh_update,
> > >  		else
> > >  			*p32 = 0;
> > >  
> > > -#if IS_ENABLED(CONFIG_IPV6)
> > > -		if (n->tbl->family == AF_INET6) {
> > > -			pin6 = (struct in6_addr *)__entry->primary_key6;
> > > +		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
> > >  			*pin6 = *(struct in6_addr *)n->primary_key;
> > 
> > Why removing the line wheer pin6 is assigned?
> > IMO, the patch should be:
> > -#if IS_ENABLED(CONFIG_IPV6)
> > -		if (n->tbl->family == AF_INET6) {
> > +		if (IS_ENABLED(CONFIG_IPV6) && n->tbl->family == AF_INET6)
> >  			pin6 = (struct in6_addr *)__entry->primary_key6;
> >   			*pin6 = *(struct in6_addr *)n->primary_key;
> > 
> > > @@ -147,15 +143,10 @@ DECLARE_EVENT_CLASS(neigh__update,
> > >  		else
> > >  			*p32 = 0;
> > >  
> > > -#if IS_ENABLED(CONFIG_IPV6)
> > > -		if (n->tbl->family == AF_INET6) {
> > > -			pin6 = (struct in6_addr *)__entry->primary_key6;
> >
> pin6  is already assigned.

OK, I see. IMO, it would be better to have 2 patches for this:
one for the redundant assignment to pin6 and anotther one for
the IS_ENABLED() change but feel free, if needed, to add my

  Reviewed-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>


-- Luc

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

* Re: [PATCH] trace: events: fix  error directive in argument list
  2019-03-30 12:01     ` Luc Van Oostenryck
@ 2019-03-30 12:40       ` Steven Rostedt
  2019-03-30 13:50         ` Roopa Prabhu
  0 siblings, 1 reply; 11+ messages in thread
From: Steven Rostedt @ 2019-03-30 12:40 UTC (permalink / raw)
  To: Luc Van Oostenryck
  Cc: Hariprasad Kelam, mingo, roopa, davem, linux-kernel, linux-sparse

On Sat, 30 Mar 2019 13:01:41 +0100
Luc Van Oostenryck <luc.vanoostenryck@gmail.com> wrote:

> OK, I see. IMO, it would be better to have 2 patches for this:
> one for the redundant assignment to pin6 and anotther one for
> the IS_ENABLED() change but feel free, if needed, to add my

I agree with it being separate patches. I'm big on the "one patch
accomplishes one task" ideology.

-- Steve

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

* Re: [PATCH] trace: events: fix error directive in argument list
  2019-03-30 12:40       ` Steven Rostedt
@ 2019-03-30 13:50         ` Roopa Prabhu
  0 siblings, 0 replies; 11+ messages in thread
From: Roopa Prabhu @ 2019-03-30 13:50 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Luc Van Oostenryck, Hariprasad Kelam, mingo, David Miller,
	Linux Kernel Mailing List, linux-sparse

On Sat, Mar 30, 2019 at 5:40 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Sat, 30 Mar 2019 13:01:41 +0100
> Luc Van Oostenryck <luc.vanoostenryck@gmail.com> wrote:
>
> > OK, I see. IMO, it would be better to have 2 patches for this:
> > one for the redundant assignment to pin6 and anotther one for
> > the IS_ENABLED() change but feel free, if needed, to add my
>
> I agree with it being separate patches. I'm big on the "one patch
> accomplishes one task" ideology.
>

yes, I will take care of the pin6 assignment separately. This patch
can only address the sparse error.

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

end of thread, other threads:[~2019-03-30 13:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25 19:53 [PATCH] trace: events: fix error directive in argument list Hariprasad Kelam
2019-03-25 20:11 ` Steven Rostedt
2019-03-27  0:20   ` Roopa Prabhu
2019-03-27  0:19 ` Roopa Prabhu
2019-03-27 15:53 ` Steven Rostedt
2019-03-29 23:12   ` Luc Van Oostenryck
2019-03-29 23:22 ` Luc Van Oostenryck
2019-03-30 11:07   ` Hariprasad Kelam
2019-03-30 12:01     ` Luc Van Oostenryck
2019-03-30 12:40       ` Steven Rostedt
2019-03-30 13:50         ` Roopa Prabhu

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).