2016-04-21 19:53:34

by Kees Cook

[permalink] [raw]
Subject: [PATCH] fs: fix over-zealous use of "const"

When I was fixing up const recommendations from checkpatch.pl, I went
overboard. This fixes the warning (during a W=1 build):

include/linux/fs.h:2627:74: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
static inline const char * const kernel_read_file_id_str(enum kernel_read_file_id id)

Reported-by: Andy Shevchenko <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
---
This is for linux-security next
---
include/linux/fs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 518716b4834e..82f9a2db3b1a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2610,7 +2610,7 @@ static const char * const kernel_read_file_str[] = {
__kernel_read_file_id(__fid_stringify)
};

-static inline const char * const kernel_read_file_id_str(enum kernel_read_file_id id)
+static inline const char *kernel_read_file_id_str(enum kernel_read_file_id id)
{
if (id < 0 || id >= READING_MAX_ID)
return kernel_read_file_str[READING_UNKNOWN];
--
2.6.3


--
Kees Cook
Chrome OS & Brillo Security


2016-04-21 22:17:41

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] fs: fix over-zealous use of "const"

On Thu, Apr 21, 2016 at 10:53 PM, Kees Cook <[email protected]> wrote:
> When I was fixing up const recommendations from checkpatch.pl, I went
> overboard. This fixes the warning (during a W=1 build):
>
> include/linux/fs.h:2627:74: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
> static inline const char * const kernel_read_file_id_str(enum kernel_read_file_id id)
>
> Reported-by: Andy Shevchenko <[email protected]>
> Signed-off-by: Kees Cook <[email protected]>

Will test next week if someone don't do that before.
Thanks.

> ---
> This is for linux-security next
> ---
> include/linux/fs.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 518716b4834e..82f9a2db3b1a 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2610,7 +2610,7 @@ static const char * const kernel_read_file_str[] = {
> __kernel_read_file_id(__fid_stringify)
> };
>
> -static inline const char * const kernel_read_file_id_str(enum kernel_read_file_id id)
> +static inline const char *kernel_read_file_id_str(enum kernel_read_file_id id)
> {
> if (id < 0 || id >= READING_MAX_ID)
> return kernel_read_file_str[READING_UNKNOWN];
> --
> 2.6.3
>
>
> --
> Kees Cook
> Chrome OS & Brillo Security



--
With Best Regards,
Andy Shevchenko

2016-04-25 09:02:03

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] fs: fix over-zealous use of "const"

On Thu, 2016-04-21 at 12:53 -0700, Kees Cook wrote:
> When I was fixing up const recommendations from checkpatch.pl, I went
> overboard. This fixes the warning (during a W=1 build):
>
> include/linux/fs.h:2627:74: warning: type qualifiers ignored on
> function return type [-Wignored-qualifiers]
> static inline const char * const kernel_read_file_id_str(enum
> kernel_read_file_id id)
>
> Reported-by: Andy Shevchenko <[email protected]>

Tested-by: Andy Shevchenko <[email protected]>

> Signed-off-by: Kees Cook <[email protected]>
> ---
> This is for linux-security next
> ---
>  include/linux/fs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 518716b4834e..82f9a2db3b1a 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2610,7 +2610,7 @@ static const char * const kernel_read_file_str[]
> = {
>   __kernel_read_file_id(__fid_stringify)
>  };
>  
> -static inline const char * const kernel_read_file_id_str(enum
> kernel_read_file_id id)
> +static inline const char *kernel_read_file_id_str(enum
> kernel_read_file_id id)
>  {
>   if (id < 0 || id >= READING_MAX_ID)
>   return kernel_read_file_str[READING_UNKNOWN];
> -- 
> 2.6.3
>
>

--
Andy Shevchenko <[email protected]>
Intel Finland Oy

2016-04-27 07:08:56

by James Morris

[permalink] [raw]
Subject: Re: [PATCH] fs: fix over-zealous use of "const"

On Thu, 21 Apr 2016, Kees Cook wrote:

> When I was fixing up const recommendations from checkpatch.pl, I went
> overboard. This fixes the warning (during a W=1 build):
>
> include/linux/fs.h:2627:74: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
> static inline const char * const kernel_read_file_id_str(enum kernel_read_file_id id)
>
> Reported-by: Andy Shevchenko <[email protected]>
> Signed-off-by: Kees Cook <[email protected]>
> ---
> This is for linux-security next
> ---

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next


--
James Morris
<[email protected]>