PROBLEM: 2.3.9 compiler warning on fs/smbfs/file.c and PATCH

David Forrest (drf5n@mug.sys.virginia.edu)
Thu, 1 Jul 1999 22:02:45 -0400 (EDT)


Proposed Patch:

diff -u linux-2.3.9/fs/smbfs/file.c.orig linux/fs/smbfs/file.c
--- linux-2.3.9/fs/smbfs/file.c.orig Thu Jul 1 20:50:36 1999
+++ linux/fs/smbfs/file.c Thu Jul 1 20:51:13 1999
@@ -266,7 +266,7 @@
* If the writer ends up delaying the write, the writer needs to
* increment the page use counts until he is done with the page.
*/
-static long smb_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf)
+static int smb_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf)
{
long status;

A bug report and my reasons are shown below.

-- 
 Dave Forrest                                dforrest@virginia.edu
 (804)-979-8634             http://www.people.virginia.edu/~drf5n/

[1.] 2.3.9 compiler warning on fs/smbfs/file.c and patch

[2.] Full description of the problem/report:

The Warning:

gcc -D__KERNEL__ -I/usr/src/linux-2.3.9/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -D__SMP__ -pipe -fno-strength-reduce -DCPU=586 -DMODULE -c -o file.o file.c file.c: In function `smb_file_write': file.c:314: warning: passing arg 5 of `generic_file_write' from incompatible pointer type

[3.] Keywords (i.e., modules, networking, kernel): module smbfs compilation warning

[4.] Kernel version (from /proc/version): Linux version 2.3.6 (root@mug) (gcc version 2.7.2.3) #4 SMP Fri Jun 25 17:11:40 EDT 1999

[5.] Output of Oops.. message (if applicable) with symbolic information resolved (see Documentation/oops-tracing.txt) NA

[6.] A small shell script or example program which triggers the problem (if possible)

(make dep ; make zImage ; make modules ; make modules_install ) &>log &

[7.] Environment [7.1.] Software (add the output of the ver_linux script here) -- Versions installed: (if some fields are empty or looks -- unusual then possibly you have very old versions) Linux mug 2.3.6 #4 SMP Fri Jun 25 17:11:40 EDT 1999 i586 unknown Kernel modules 2.1.121 Gnu C 2.7.2.3 Binutils 2.9.1.0.19 Linux C Library 5.4.46 Dynamic linker ldd: version 1.9.9 Linux C++ Library 2.9.0 Procps 2.0.2 Mount 2.9i Net-tools 1.52 Kbd 0.94 Sh-utils 1.16 Modules Loaded vmnet vmmon serial unix ne 8390

[7.2.] Processor information (from /proc/cpuinfo): processor : 0 vendor_id : AuthenticAMD cpu family : 5 model : 8 model name : AMD-K6(tm) 3D processor stepping : 12 cpu MHz : 300.690108 fdiv_bug : no hlt_bug : no sep_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr mce cx8 sep mtrr pge mmx 3dnow bogomips : 599.65

[7.3.] Module information (from /proc/modules): vmnet 10120 1 vmmon 12696 0 (unused) serial 20524 1 (autoclean) unix 12228 43 (autoclean) ne 6440 1 8390 6704 0 [ne]

[7.4.] SCSI information (from /proc/scsi/scsi) [7.5.] Other information that might be relevant to the problem (please look in /proc and include all information that you think to be relevant):

[X.] Other notes, patches, fixes, workarounds:

The Code at /usr/src/linux-2.3.9/fs/smbfs/file.c:314:

result = generic_file_write(file, buf, count, ppos, smb_write_one_page);

The Def of smb_write_one_page in /usr/src/linux-2.3.9/fs/smbfs/file.c:269

static long smb_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf)

The Definition of generic_file_write in /usr/src/linux-2.3.9/mm/filemap.c:1793

ssize_t generic_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos, writepage_t write_one_page)

The definition of writepage_t in /usr/src/linux-2.3.9/include/linux/fs.h

typedef int (*writepage_t)(struct file *, struct page *, unsigned long, unsigned long, const char *);

Diagnosis:

It should be a pointer to a function returning an int, and smb_write_one_page is a long.

Testing:

My modules compiled with no warnings.

gcc -D__KERNEL__ -I/usr/src/linux-2.3.9/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -D__SMP__ -pipe -fno-strength-reduce -DCPU= 586 -DMODULE -c -o file.o file.c rm -f smbfs.o ld -m elf_i386 -r -o smbfs.o proc.o dir.o cache.o sock.o inode.o file.o ioctl.o

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