ips.c warnings
Never seen this before.
drivers/scsi/ips.c: In function `ips_scmd_buf_write':drivers/scsi/ips.c:3665: warning: null argument where non-null required (arg 1) drivers/scsi/ips.c: In function `ips_scmd_buf_read':drivers/scsi/ips.c:3697: warning: null argument where non-null required (arg 2) drivers/scsi/ips.c: In function `ips_register_scsi':
Due to
memcpy(IPS_SG_ADDRESS(&sg[i]), &cdata[xfer_cnt],
min_cnt);I guess the compiler is saying that if IPS_SG_ADDRESS indeed evaluates to NULL (as it is designed to do), we have an oops.
That's an x86_64 allmodconfig build, btw.
Quoted 6 lines · Andrew Morton
drivers/scsi/ips.c: In function `ips_scmd_buf_write':drivers/scsi/ips.c:3665: warning: null argument where non-null required (arg 1)drivers/scsi/ips.c: In function `ips_scmd_buf_read':drivers/scsi/ips.c:3697: warning: null argument where non-null required (arg 2)drivers/scsi/ips.c: In function `ips_register_scsi':
Quoted 7 lines
Due to
memcpy(IPS_SG_ADDRESS(&sg[i]), &cdata[xfer_cnt], min_cnt);I guess the compiler is saying that if
IPS_SG_ADDRESSindeed evaluates to NULL (as it is designed to do), we have an oops.
That's weird ... the compiler can't possibly be in a position to make that judgement call. We have lots of places where we return null if something goes wrong and the kernel oopses. The compiler certainly isn't warning about all of them.
James
Quoted 13 lines · James Bottomley
Quoted 11 lines · Andrew Morton
drivers/scsi/ips.c: In function `ips_scmd_buf_write':drivers/scsi/ips.c:3665: warning: null argument where non-null required (arg 1)drivers/scsi/ips.c: In function `ips_scmd_buf_read':drivers/scsi/ips.c:3697: warning: null argument where non-null required (arg 2)drivers/scsi/ips.c: In function `ips_register_scsi':Due to
memcpy(IPS_SG_ADDRESS(&sg[i]), &cdata[xfer_cnt], min_cnt);
Quoted 7 lines
Quoted 2 lines
I guess the compiler is saying that if
IPS_SG_ADDRESSindeed evaluates to NULL (as it is designed to do), we have an oops.That's weird ... the compiler can't possibly be in a position to make that judgement call. We have lots of places where we return null if something goes wrong and the kernel oopses. The compiler certainly isn't warning about all of them.
Well I guess the difference is that the compiler can _see_ that IPS_SG_ADDRESS() might return NULL:
#define IPS_SG_ADDRESS(sg) (page_address((sg)->page) ? \
page_address((sg)->page)+(sg)->offset : NULL)What's the point in this expression anyway? Why not just assume that page_address() returns non-NULL?
Quoted 6 lines · Andrew Morton
Quoted 4 lines · James Bottomley
That's weird ... the compiler can't possibly be in a position to make that judgement call. We have lots of places where we return null if something goes wrong and the kernel oopses. The compiler certainly isn't warning about all of them.
Quoted 8 lines
Well I guess the difference is that the compiler can _see_ that
IPS_SG_ADDRESS()might return NULL:#define IPS_SG_ADDRESS(sg) (page_address((sg)->page) ? \ page_address((sg)->page)+(sg)->offset : NULL)What's the point in this expression anyway? Why not just assume that
page_address()returns non-NULL?
Actually, what it should be doing is a kmap/kunmap on page instead of assuming the page has an address ... hopefully the IPS people can fix it.
James
Quoted 14 lines · James Bottomley
Quoted 12 lines · Andrew Morton
Quoted 4 lines · James Bottomley
That's weird ... the compiler can't possibly be in a position to make that judgement call. We have lots of places where we return null if something goes wrong and the kernel oopses. The compiler certainly isn't warning about all of them.
Well I guess the difference is that the compiler can _see_ that
IPS_SG_ADDRESS()might return NULL:#define IPS_SG_ADDRESS(sg) (page_address((sg)->page) ? \ page_address((sg)->page)+(sg)->offset : NULL)
Quoted 7 lines
Quoted 2 lines
What's the point in this expression anyway? Why not just assume that
page_address()returns non-NULL?Actually, what it should be doing is a kmap/kunmap on page instead of assuming the page has an address ... hopefully the IPS people can fix it.
(cc's the IPS people)