public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -mm] megaraid gcc 4.1 warning fix
@ 2006-05-10  2:56 Daniel Walker
  2006-05-10  6:15 ` Pekka Enberg
  2006-05-10 10:39 ` Alan Cox
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Walker @ 2006-05-10  2:56 UTC (permalink / raw)
  To: akpm; +Cc: Seokmann.Ju, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2785 bytes --]

Fixes the following warning,

drivers/scsi/megaraid.c: In function ‘issue_scb’:
drivers/scsi/megaraid.c:1153: warning: passing argument 2 of ‘writel’ makes pointer from integer without a cast
drivers/scsi/megaraid.c: In function ‘issue_scb_block’:
drivers/scsi/megaraid.c:1216: warning: passing argument 2 of ‘writel’ makes pointer from integer without a cast
drivers/scsi/megaraid.c:1229: warning: passing argument 2 of ‘writel’ makes pointer from integer without a cast
drivers/scsi/megaraid.c:1231: warning: passing argument 1 of ‘readl’ makes pointer from integer without a cast
drivers/scsi/megaraid.c: In function ‘megaraid_isr_memmapped’:
drivers/scsi/megaraid.c:1361: warning: passing argument 1 of ‘readl’ makes pointer from integer without a cast
drivers/scsi/megaraid.c:1368: warning: passing argument 2 of ‘writel’ makes pointer from integer without a cast
drivers/scsi/megaraid.c:1387: warning: passing argument 2 of ‘writel’ makes pointer from integer without a cast
drivers/scsi/megaraid.c:1391: warning: passing argument 1 of ‘readl’ makes pointer from integer without a cast
drivers/scsi/megaraid.c: In function ‘megadev_ioctl’:
drivers/scsi/megaraid.c:3665: warning: ignoring return value of ‘copy_to_user’, declared with attribute warn_unused_result


Signed-Off-By: Daniel Walker <dwalker@mvista.com>

Index: linux-2.6.16/drivers/scsi/megaraid.c
===================================================================
--- linux-2.6.16.orig/drivers/scsi/megaraid.c
+++ linux-2.6.16/drivers/scsi/megaraid.c
@@ -73,10 +73,10 @@ static unsigned short int max_mbox_busy_
 module_param(max_mbox_busy_wait, ushort, 0);
 MODULE_PARM_DESC(max_mbox_busy_wait, "Maximum wait for mailbox in microseconds if busy (default=MBOX_BUSY_WAIT=10)");
 
-#define RDINDOOR(adapter)		readl((adapter)->base + 0x20)
-#define RDOUTDOOR(adapter)		readl((adapter)->base + 0x2C)
-#define WRINDOOR(adapter,value)		writel(value, (adapter)->base + 0x20)
-#define WROUTDOOR(adapter,value)	writel(value, (adapter)->base + 0x2C)
+#define RDINDOOR(adapter)		readl((void*)((adapter)->base + 0x20))
+#define RDOUTDOOR(adapter)		readl((void*)((adapter)->base + 0x2C))
+#define WRINDOOR(adapter,value)		writel(value, (void *)((adapter)->base + 0x20))
+#define WROUTDOOR(adapter,value)	writel(value, (void*)((adapter)->base + 0x2C))
 
 /*
  * Global variables
@@ -3662,8 +3662,9 @@ megadev_ioctl(struct inode *inode, struc
 			 * Send the request sense data also, irrespective of
 			 * whether the user has asked for it or not.
 			 */
-			copy_to_user(upthru->reqsensearea,
-					pthru->reqsensearea, 14);
+			if (copy_to_user(upthru->reqsensearea,
+					pthru->reqsensearea, 14))
+				return -EFAULT;
 
 freemem_and_return:
 			if( pthru->dataxferlen ) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -mm] megaraid gcc 4.1 warning fix
  2006-05-10  2:56 [PATCH -mm] megaraid gcc 4.1 warning fix Daniel Walker
@ 2006-05-10  6:15 ` Pekka Enberg
  2006-05-10 10:39 ` Alan Cox
  1 sibling, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2006-05-10  6:15 UTC (permalink / raw)
  To: Daniel Walker; +Cc: akpm, Seokmann.Ju, linux-kernel

Hi Daniel,

On 5/10/06, Daniel Walker <dwalker@mvista.com> wrote:
> -#define RDINDOOR(adapter)              readl((adapter)->base + 0x20)
> -#define RDOUTDOOR(adapter)             readl((adapter)->base + 0x2C)
> -#define WRINDOOR(adapter,value)                writel(value, (adapter)->base + 0x20)
> -#define WROUTDOOR(adapter,value)       writel(value, (adapter)->base + 0x2C)
> +#define RDINDOOR(adapter)              readl((void*)((adapter)->base + 0x20))
> +#define RDOUTDOOR(adapter)             readl((void*)((adapter)->base + 0x2C))
> +#define WRINDOOR(adapter,value)                writel(value, (void *)((adapter)->base + 0x20))
> +#define WROUTDOOR(adapter,value)       writel(value, (void*)((adapter)->base + 0x2C))

This looks wrong. adapter->base should be void __iomem *.

                                        Pekka

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -mm] megaraid gcc 4.1 warning fix
  2006-05-10  2:56 [PATCH -mm] megaraid gcc 4.1 warning fix Daniel Walker
  2006-05-10  6:15 ` Pekka Enberg
@ 2006-05-10 10:39 ` Alan Cox
  2006-05-10 14:13   ` Daniel Walker
  2006-05-10 14:21   ` Daniel Walker
  1 sibling, 2 replies; 7+ messages in thread
From: Alan Cox @ 2006-05-10 10:39 UTC (permalink / raw)
  To: Daniel Walker; +Cc: akpm, Seokmann.Ju, linux-kernel

On Maw, 2006-05-09 at 19:56 -0700, Daniel Walker wrote:
> Fixes the following warning,
> 
> drivers/scsi/megaraid.c: In function ‘issue_scb’:
> drivers/scsi/megaraid.c:1153: warning: passing argument 2 of ‘writel’ makes pointer from integer without a cast

And adds an exploitable memory leak. Please don't fix "bugs" blindly but
check that the error path still releases all the relevant resources.

In this case its probably sufficient just to set rval and fal through,
but each one needs to be reviewed properly.

Alan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -mm] megaraid gcc 4.1 warning fix
  2006-05-10 10:39 ` Alan Cox
@ 2006-05-10 14:13   ` Daniel Walker
  2006-05-10 14:21   ` Daniel Walker
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Walker @ 2006-05-10 14:13 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, Seokmann.Ju, linux-kernel

On Wed, 2006-05-10 at 11:39 +0100, Alan Cox wrote:
> On Maw, 2006-05-09 at 19:56 -0700, Daniel Walker wrote:
> > Fixes the following warning,
> > 
> > drivers/scsi/megaraid.c: In function ‘issue_scb’:
> > drivers/scsi/megaraid.c:1153: warning: passing argument 2 of ‘writel’ makes pointer from integer without a cast
> 
> And adds an exploitable memory leak. Please don't fix "bugs" blindly but
> check that the error path still releases all the relevant resources.

I did nothing blindly .. I have a queue of 50+ more of these. I
researched every error path , and made sure the warning wasn't an actual
problem. If it was a problem , or I wasn't sure if the fix was 100% I
sent it to LKML ..

Daniel




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -mm] megaraid gcc 4.1 warning fix
  2006-05-10 10:39 ` Alan Cox
  2006-05-10 14:13   ` Daniel Walker
@ 2006-05-10 14:21   ` Daniel Walker
  2006-05-10 15:08     ` Alan Cox
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel Walker @ 2006-05-10 14:21 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, Seokmann.Ju, linux-kernel

On Wed, 2006-05-10 at 11:39 +0100, Alan Cox wrote:
> On Maw, 2006-05-09 at 19:56 -0700, Daniel Walker wrote:
> > Fixes the following warning,
> > 
> > drivers/scsi/megaraid.c: In function ‘issue_scb’:
> > drivers/scsi/megaraid.c:1153: warning: passing argument 2 of ‘writel’ makes pointer from integer without a cast
> 
> And adds an exploitable memory leak. Please don't fix "bugs" blindly but
> check that the error path still releases all the relevant resources.
> 
> In this case its probably sufficient just to set rval and fal through,
> but each one needs to be reviewed properly.

The writel on 1153 is attached to a memory leak, or I add one in this
patch ?

Daniel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -mm] megaraid gcc 4.1 warning fix
  2006-05-10 15:08     ` Alan Cox
@ 2006-05-10 15:03       ` Daniel Walker
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Walker @ 2006-05-10 15:03 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, Seokmann.Ju, linux-kernel

On Wed, 2006-05-10 at 16:08 +0100, Alan Cox wrote:
> On Mer, 2006-05-10 at 07:21 -0700, Daniel Walker wrote:
> > The writel on 1153 is attached to a memory leak, or I add one in this
> > patch ?
> 
> You exit without cleaning up.


Your talking about this warning ,

drivers/scsi/megaraid.c: In function ‘megadev_ioctl’:
drivers/scsi/megaraid.c:3665: warning: ignoring return value of ‘copy_to_user’, declared with attribute warn_unused_result


Ahh, I see .. I'll set rval as you suggested ..

Daniel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -mm] megaraid gcc 4.1 warning fix
  2006-05-10 14:21   ` Daniel Walker
@ 2006-05-10 15:08     ` Alan Cox
  2006-05-10 15:03       ` Daniel Walker
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Cox @ 2006-05-10 15:08 UTC (permalink / raw)
  To: Daniel Walker; +Cc: akpm, Seokmann.Ju, linux-kernel

On Mer, 2006-05-10 at 07:21 -0700, Daniel Walker wrote:
> The writel on 1153 is attached to a memory leak, or I add one in this
> patch ?

You exit without cleaning up.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-05-10 15:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-10  2:56 [PATCH -mm] megaraid gcc 4.1 warning fix Daniel Walker
2006-05-10  6:15 ` Pekka Enberg
2006-05-10 10:39 ` Alan Cox
2006-05-10 14:13   ` Daniel Walker
2006-05-10 14:21   ` Daniel Walker
2006-05-10 15:08     ` Alan Cox
2006-05-10 15:03       ` Daniel Walker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox