lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 19 Aug 2020 14:40:01 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Alexander Viro <viro@...iv.linux.org.uk>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs: Add function declaration of simple_dname

On Wed, Aug 19, 2020 at 12:34:24PM +0100, Matthew Wilcox wrote:
> On Wed, Aug 19, 2020 at 11:32:59AM +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@...dia.com>
> >
> > The simple_dname() is declared in internal header file as extern
> > and this generates the following GCC warning.
>
> The fact that it's declared as extern doesn't matter.  You don't need
> the change to internal.h at all.  The use of 'extern' on a function
> declaration is purely decorative:
>
>   5 If the declaration of an identifier for a function has no
>   storage-class specifier, its linkage is determined exactly as if it
>   were declared with the storage-class specifier extern.

So why do we need to keep extern keyword if we use intenral.h directly?

>
> I'd drop the change to internal.h and fix the changelog.

Thanks

>
> > fs/d_path.c:311:7: warning: no previous prototype for 'simple_dname' [-Wmissing-prototypes]
> >   311 | char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
> >       |       ^~~~~~~~~~~~
> >
> > Instead of that extern, reuse the fact that internal.h file is internal to fs/* and
> > declare simple_dname() like any other function.
> >
> > Fixes: 7e5f7bb08b8c ("unexport simple_dname()")
> > Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> > ---
> >  fs/d_path.c   | 2 ++
> >  fs/internal.h | 2 +-
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/d_path.c b/fs/d_path.c
> > index 0f1fc1743302..4b89448cc78e 100644
> > --- a/fs/d_path.c
> > +++ b/fs/d_path.c
> > @@ -8,6 +8,8 @@
> >  #include <linux/prefetch.h>
> >  #include "mount.h"
> >
> > +#include "internal.h"
> > +
> >  static int prepend(char **buffer, int *buflen, const char *str, int namelen)
> >  {
> >  	*buflen -= namelen;
> > diff --git a/fs/internal.h b/fs/internal.h
> > index 10517ece4516..2def264272f4 100644
> > --- a/fs/internal.h
> > +++ b/fs/internal.h
> > @@ -164,7 +164,7 @@ extern int d_set_mounted(struct dentry *dentry);
> >  extern long prune_dcache_sb(struct super_block *sb, struct shrink_control *sc);
> >  extern struct dentry *d_alloc_cursor(struct dentry *);
> >  extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
> > -extern char *simple_dname(struct dentry *, char *, int);
> > +char *simple_dname(struct dentry *d, char *buf, int len);
> >  extern void dput_to_list(struct dentry *, struct list_head *);
> >  extern void shrink_dentry_list(struct list_head *);
> >
> > --
> > 2.26.2
> >

Powered by blists - more mailing lists