Skip to contentSkip to conversation

fs: fix over-zealous use of "const"

PATCH In review Kees Cook 4 participants 4 messages Apr 21, 2016 – Apr 27, 2016 VFS

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 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)

---
This is for linux-security next

---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/fs.h +1 -1
index 518716b4834e..82f9a2db3b1a 100644
@@ -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];
Signature · 6 lines
2.6.3


-- 
Kees Cook
Chrome OS & Brillo Security
#1 lore raw
Quoted 8 lines · Kees Cook

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)

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

Quoted 26 lines

---
This is for linux-security next

---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/fs.h +1 -2
index 518716b4834e..82f9a2db3b1a 100644
@@ -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

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Tested-by on v1 1/1
#2 lore raw
In reply to Kees Cook
Quoted 9 lines · Kees Cook

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)

Quoted 27 lines

---
This is for linux-security next
---
 include/linux/fs.h | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/fs.h +0 -0
index 518716b4834e..82f9a2db3b1a 100644
@@ -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

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw
In reply to Kees Cook
Quoted 11 lines · Kees Cook

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)

---
This is for linux-security next
---

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

Signature · 2 lines
James Morris
<[email protected]>