* [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types)
@ 2012-08-26 19:12 Fengguang Wu
2012-08-26 19:26 ` [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base typ Cyrill Gorcunov
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Fengguang Wu @ 2012-08-26 19:12 UTC (permalink / raw)
To: kernel-janitors
Hi Cyrill,
FYI, there are new sparse warnings show up in
tree: git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git master
head: 9283194882d18e3755c4ebc0b86db9f9a4f4c81a
commit: c8506285ded8009f7c1ab937fc0021c6294ba424 [30/32] procfs: Move /proc/pid/fd[info] handling code to fd.[ch]
All sparse warnings:
+ fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types)
fs/proc/fd.c:87:55: expected unsigned int [unsigned] f_mode
fs/proc/fd.c:87:55: got restricted fmode_t [usertype] f_mode
+ fs/proc/fd.c:105:54: sparse: restricted fmode_t degrades to integer
fs/proc/fd.c:107:54: sparse: restricted fmode_t degrades to integer
vim +87 fs/proc/fd.c
84 rcu_read_lock();
85 file = fcheck_files(files, fd);
86 if (file) {
> 87 unsigned f_mode = file->f_mode;
88
89 rcu_read_unlock();
90 put_files_struct(files);
---
0-DAY kernel build testing backend Open Source Technology Centre
Fengguang Wu <wfg@linux.intel.com> Intel Corporation
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base typ
2012-08-26 19:12 [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types) Fengguang Wu
@ 2012-08-26 19:26 ` Cyrill Gorcunov
2012-08-26 19:52 ` Cyrill Gorcunov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2012-08-26 19:26 UTC (permalink / raw)
To: kernel-janitors
On Mon, Aug 27, 2012 at 03:12:57AM +0800, Fengguang Wu wrote:
> Hi Cyrill,
>
> FYI, there are new sparse warnings show up in
>
> tree: git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git master
> head: 9283194882d18e3755c4ebc0b86db9f9a4f4c81a
> commit: c8506285ded8009f7c1ab937fc0021c6294ba424 [30/32] procfs: Move /proc/pid/fd[info] handling code to fd.[ch]
>
> All sparse warnings:
>
> + fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types)
> fs/proc/fd.c:87:55: expected unsigned int [unsigned] f_mode
> fs/proc/fd.c:87:55: got restricted fmode_t [usertype] f_mode
> + fs/proc/fd.c:105:54: sparse: restricted fmode_t degrades to integer
> fs/proc/fd.c:107:54: sparse: restricted fmode_t degrades to integer
>
> vim +87 fs/proc/fd.c
> 84 rcu_read_lock();
> 85 file = fcheck_files(files, fd);
> 86 if (file) {
> > 87 unsigned f_mode = file->f_mode;
> 88
> 89 rcu_read_unlock();
> 90 put_files_struct(files);
Sigh. Thanks a lot, Fengguang! This routine has been moved from base.c
(which had this nit already). Al, could you please make it unsigned int,
and push fix intou your tree?
Cyrill
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base typ
2012-08-26 19:12 [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types) Fengguang Wu
2012-08-26 19:26 ` [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base typ Cyrill Gorcunov
@ 2012-08-26 19:52 ` Cyrill Gorcunov
2012-08-26 20:20 ` Al Viro
2012-08-26 20:40 ` Cyrill Gorcunov
3 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2012-08-26 19:52 UTC (permalink / raw)
To: kernel-janitors
On Sun, Aug 26, 2012 at 11:26:20PM +0400, Cyrill Gorcunov wrote:
> On Mon, Aug 27, 2012 at 03:12:57AM +0800, Fengguang Wu wrote:
> > Hi Cyrill,
> >
> > FYI, there are new sparse warnings show up in
> >
> > tree: git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git master
> > head: 9283194882d18e3755c4ebc0b86db9f9a4f4c81a
> > commit: c8506285ded8009f7c1ab937fc0021c6294ba424 [30/32] procfs: Move /proc/pid/fd[info] handling code to fd.[ch]
> >
> > All sparse warnings:
> >
> > + fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types)
> > fs/proc/fd.c:87:55: expected unsigned int [unsigned] f_mode
> > fs/proc/fd.c:87:55: got restricted fmode_t [usertype] f_mode
> > + fs/proc/fd.c:105:54: sparse: restricted fmode_t degrades to integer
> > fs/proc/fd.c:107:54: sparse: restricted fmode_t degrades to integer
> >
> > vim +87 fs/proc/fd.c
> > 84 rcu_read_lock();
> > 85 file = fcheck_files(files, fd);
> > 86 if (file) {
> > > 87 unsigned f_mode = file->f_mode;
> > 88
> > 89 rcu_read_unlock();
> > 90 put_files_struct(files);
>
> Sigh. Thanks a lot, Fengguang! This routine has been moved from base.c
> (which had this nit already). Al, could you please make it unsigned int,
> and push fix intou your tree?
This should fix the problem (if needed, since the next commit in series
should drop this declaration). Also this patch changes type for i_mode,
which I think a good idea.
---
From: Cyrill Gorcunov <gorcunov@openvz.org>
Subject: fs, proc: Fix sparse warning in tid_fd_revalidate
The following warnings have been caught
| + fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types)
| fs/proc/fd.c:87:55: expected unsigned int [unsigned] f_mode
| fs/proc/fd.c:87:55: got restricted fmode_t [usertype] f_mode
| + fs/proc/fd.c:105:54: sparse: restricted fmode_t degrades to integer
| fs/proc/fd.c:107:54: sparse: restricted fmode_t degrades to integer
make f_mode and i_mode declared with proper types.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Al Viro <viro@ZenIV.linux.org.uk>
---
fs/proc/fd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6.git/fs/proc/fd.c
=================================--- linux-2.6.git.orig/fs/proc/fd.c
+++ linux-2.6.git/fs/proc/fd.c
@@ -84,7 +84,7 @@ static int tid_fd_revalidate(struct dent
rcu_read_lock();
file = fcheck_files(files, fd);
if (file) {
- unsigned f_mode = file->f_mode;
+ unsigned int f_mode = file->f_mode;
rcu_read_unlock();
put_files_struct(files);
@@ -101,7 +101,7 @@ static int tid_fd_revalidate(struct dent
}
if (S_ISLNK(inode->i_mode)) {
- unsigned i_mode = S_IFLNK;
+ umode_t i_mode = S_IFLNK;
if (f_mode & FMODE_READ)
i_mode |= S_IRUSR | S_IXUSR;
if (f_mode & FMODE_WRITE)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base typ
2012-08-26 19:12 [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types) Fengguang Wu
2012-08-26 19:26 ` [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base typ Cyrill Gorcunov
2012-08-26 19:52 ` Cyrill Gorcunov
@ 2012-08-26 20:20 ` Al Viro
2012-08-26 20:40 ` Cyrill Gorcunov
3 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2012-08-26 20:20 UTC (permalink / raw)
To: kernel-janitors
On Sun, Aug 26, 2012 at 11:52:36PM +0400, Cyrill Gorcunov wrote:
> - unsigned f_mode = file->f_mode;
> + unsigned int f_mode = file->f_mode;
This changes nothing; unsigned and unsigned int are exactly the same.
fmode_t isn't, from sparse POV, and that's what you want to use here.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base typ
2012-08-26 19:12 [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types) Fengguang Wu
` (2 preceding siblings ...)
2012-08-26 20:20 ` Al Viro
@ 2012-08-26 20:40 ` Cyrill Gorcunov
3 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2012-08-26 20:40 UTC (permalink / raw)
To: kernel-janitors
On Sun, Aug 26, 2012 at 09:20:49PM +0100, Al Viro wrote:
> On Sun, Aug 26, 2012 at 11:52:36PM +0400, Cyrill Gorcunov wrote:
> > - unsigned f_mode = file->f_mode;
> > + unsigned int f_mode = file->f_mode;
>
> This changes nothing; unsigned and unsigned int are exactly the same.
> fmode_t isn't, from sparse POV, and that's what you want to use here.
True. I get messed with this warning. Please see updated below.
---
From: Cyrill Gorcunov <gorcunov@openvz.org>
Subject: fs, proc: Fix sparse warning in tid_fd_revalidate
The following warnings have been caught
| + fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types)
| fs/proc/fd.c:87:55: expected unsigned int [unsigned] f_mode
| fs/proc/fd.c:87:55: got restricted fmode_t [usertype] f_mode
| + fs/proc/fd.c:105:54: sparse: restricted fmode_t degrades to integer
| fs/proc/fd.c:107:54: sparse: restricted fmode_t degrades to integer
make f_mode and i_mode declared with proper types.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Al Viro <viro@ZenIV.linux.org.uk>
---
fs/proc/fd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6.git/fs/proc/fd.c
=================================--- linux-2.6.git.orig/fs/proc/fd.c
+++ linux-2.6.git/fs/proc/fd.c
@@ -84,7 +84,7 @@ static int tid_fd_revalidate(struct dent
rcu_read_lock();
file = fcheck_files(files, fd);
if (file) {
- unsigned f_mode = file->f_mode;
+ fmode_t f_mode = file->f_mode;
rcu_read_unlock();
put_files_struct(files);
@@ -101,7 +101,7 @@ static int tid_fd_revalidate(struct dent
}
if (S_ISLNK(inode->i_mode)) {
- unsigned i_mode = S_IFLNK;
+ umode_t i_mode = S_IFLNK;
if (f_mode & FMODE_READ)
i_mode |= S_IRUSR | S_IXUSR;
if (f_mode & FMODE_WRITE)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-26 20:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-26 19:12 [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base types) Fengguang Wu
2012-08-26 19:26 ` [vfs:master 30/32] fs/proc/fd.c:87:55: sparse: incorrect type in initializer (different base typ Cyrill Gorcunov
2012-08-26 19:52 ` Cyrill Gorcunov
2012-08-26 20:20 ` Al Viro
2012-08-26 20:40 ` Cyrill Gorcunov
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).