Re: [PATCH v2 3/3] lib/vsprintf: Force type of flags value for gfp_t
On (20/07/31 16:49), Steven Rostedt wrote: > On Fri, 31 Jul 2020 21:08:24 +0300 > Andy Shevchenko wrote: > > > Sparse is not happy about restricted type being assigned: > > lib/vsprintf.c:1940:23: warning: incorrect type in assignment (different > > base types) > > lib/vsprintf.c:1940:23:expected unsigned long [assigned] flags > > lib/vsprintf.c:1940:23:got restricted gfp_t [usertype] > > > > Force type of flags value to make sparse happy. > > > > Cc: Steven Rostedt (VMware) > > Reviewed-by: Steven Rostedt (VMware) Thanks. > Petr or Sergey, > > Want to take these through the printk tree? Can take through the printk-tree. -ss
Re: [PATCH v2 3/3] lib/vsprintf: Force type of flags value for gfp_t
On Fri, 31 Jul 2020 21:08:24 +0300 Andy Shevchenko wrote: > Sparse is not happy about restricted type being assigned: > lib/vsprintf.c:1940:23: warning: incorrect type in assignment (different > base types) > lib/vsprintf.c:1940:23:expected unsigned long [assigned] flags > lib/vsprintf.c:1940:23:got restricted gfp_t [usertype] > > Force type of flags value to make sparse happy. > > Cc: Steven Rostedt (VMware) Reviewed-by: Steven Rostedt (VMware) Petr or Sergey, Want to take these through the printk tree? -- Steve > Signed-off-by: Andy Shevchenko > --- > v2: used explicit type to be forced to (Steven) > lib/vsprintf.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > index 182a3e2e1629..c155769559ab 100644 > --- a/lib/vsprintf.c > +++ b/lib/vsprintf.c > @@ -1937,7 +1937,7 @@ char *flags_string(char *buf, char *end, void > *flags_ptr, > names = vmaflag_names; > break; > case 'g': > - flags = *(gfp_t *)flags_ptr; > + flags = (__force unsigned long)(*(gfp_t *)flags_ptr); > names = gfpflag_names; > break; > default:
[PATCH v2 3/3] lib/vsprintf: Force type of flags value for gfp_t
Sparse is not happy about restricted type being assigned: lib/vsprintf.c:1940:23: warning: incorrect type in assignment (different base types) lib/vsprintf.c:1940:23:expected unsigned long [assigned] flags lib/vsprintf.c:1940:23:got restricted gfp_t [usertype] Force type of flags value to make sparse happy. Cc: Steven Rostedt (VMware) Signed-off-by: Andy Shevchenko --- v2: used explicit type to be forced to (Steven) lib/vsprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 182a3e2e1629..c155769559ab 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1937,7 +1937,7 @@ char *flags_string(char *buf, char *end, void *flags_ptr, names = vmaflag_names; break; case 'g': - flags = *(gfp_t *)flags_ptr; + flags = (__force unsigned long)(*(gfp_t *)flags_ptr); names = gfpflag_names; break; default: -- 2.27.0