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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <154e089b0812161144x3c9579f5g8731b616fde6484c@mail.gmail.com>
Date:	Tue, 16 Dec 2008 20:44:56 +0100
From:	"Hannes Eder" <hannes@...neseder.net>
To:	"Ben Dooks" <ben-linux@...ff.org>
Cc:	"Jiri Kosina" <jkosina@...e.cz>, linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] HID: avoid sparse warning in HID_COMPAT_LOAD_DRIVER

On Tue, Dec 16, 2008 at 5:01 PM, Jiri Kosina <jkosina@...e.cz> wrote:
> On Tue, 16 Dec 2008, Ben Dooks wrote:
>
>> >  #ifdef CONFIG_HID_COMPAT
>> >  #define HID_COMPAT_LOAD_DRIVER(name)       \
>> > +/* prototype to avoid sparse warning */    \
>> > +extern void hid_compat_##name(void);       \
>> >  void hid_compat_##name(void) { }   \
>> surely this could simply be changed to 'static void
>> hid_compat_##name(void)' if it is only being defined to be an empty
>
> This will cause gcc emit warnings about unused symbols.

The real problem is that the symbol (in that case the function) is not
exported if defined static.

e.g.:

$ cat >foobar.c <<EOF
> static void foo(void) {}
> extern void foo(void);
>
> void bar(void) {}
> EOF
$ gcc -c foobar.c
$ nm foobar.o
00000005 T bar
00000000 t foo

from the nm manpage:
The  symbol  type. ... If lowercase, the symbol is local; if
uppercase, the symbol is global (external)

i.e. foo is local

see http://lkml.org/lkml/2008/9/4/495 for what ANSI C Std has to say
about that and about the proposed change.

But, don't ask my why the void functions with empty function bodies
are exported.

On Tue, Dec 16, 2008 at 8:41 PM, Ben Dooks <ben-linux@...ff.org> wrote:
> sorry, 'static inline void' then.

in that case the symbol would not even be local as it is not used with
the translation unit.

$ nm
00000005 T bar

-Hannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ