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] [day] [month] [year] [list]
Date:	Wed, 25 Oct 2006 21:50:20 -0700
From:	"Randy.Dunlap" <randy.dunlap@...cle.com>
To:	ankita@...ibm.com
CC:	lkml <linux-kernel@...r.kernel.org>, akpm <akpm@...l.org>
Subject: Re: [PATCH] lkdtm: cleanup headers and module_param/MODULE_PARM_DESC

Ankita Garg wrote:
> Hi,
> 
>>  #include <linux/kernel.h>
>> +#include <linux/fs.h>
>>  #include <linux/module.h>
>> +#include <linux/buffer_head.h>
>>  #include <linux/kprobes.h>
>> -#include <linux/kallsyms.h>
>> +#include <linux/list.h>
>>  #include <linux/init.h>
>> -#include <linux/irq.h>
>>  #include <linux/interrupt.h>
>> +#include <linux/hrtimer.h>
>>  #include <scsi/scsi_cmnd.h>
> 
> Why does the module require fs.h, hrtimer.h, list.h and buffer_head.h? It works fine for me without these header files. I do not get any gcc warning. Moreover, I found that even init.h and interrupt.h are also not required.

fs.h:  struct file *, struct block_device *
hrtimer.h:  struct hrtimer *
list.h:  struct list_head *
buffer_head.h:  struct buffer_head *

struct buffer_head is what triggered this.  gcc warns like this:

  CC [M]  drivers/misc/lkdtm.o
drivers/misc/lkdtm.c:150: warning: 'struct buffer_head' declared inside parameter list
drivers/misc/lkdtm.c:150: warning: its scope is only this definition or declaration, which is probably not what you want

or you could not #include those files and just do new source code lines like:

struct hrtimer;
struct buffer_head;
struct file;
struct block_dev;
struct list_head;

What we want to see is that source files explicly #include all header files
that they need or use, for structs, unions, extern data, function APIs, etc.
What is happening with lkdtm is that one or more header files is doing
this for you.  We want it to be more explicit than that.

-- 
~Randy
-
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