public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch -next] bcma: signedness bug in bcma_get_next_core()
@ 2011-08-18 13:38 Dan Carpenter
  2011-08-20 12:23 ` Rafał Miłecki
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Dan Carpenter @ 2011-08-18 13:38 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: open list:BROADCOM SPECIFIC..., kernel-janitors

The u32 would never be less than zero so the error handling would
break.  I changed it to int.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index 0ea390f..1361d8d 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -281,7 +281,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
 
 	/* get & parse master ports */
 	for (i = 0; i < ports[0]; i++) {
-		u32 mst_port_d = bcma_erom_get_mst_port(bus, eromptr);
+		int mst_port_d = bcma_erom_get_mst_port(bus, eromptr);
 		if (mst_port_d < 0)
 			return -EILSEQ;
 	}

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

* Re: [patch -next] bcma: signedness bug in bcma_get_next_core()
  2011-08-18 13:38 [patch -next] bcma: signedness bug in bcma_get_next_core() Dan Carpenter
@ 2011-08-20 12:23 ` Rafał Miłecki
  2011-08-20 12:59   ` walter harms
                     ` (2 more replies)
  2011-08-20 14:11 ` [patch -next] " walter harms
  2011-08-20 14:17 ` Rafał Miłecki
  2 siblings, 3 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-08-20 12:23 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: open list:BROADCOM SPECIFIC..., kernel-janitors

W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
<error27@gmail.com> napisał:
> The u32 would never be less than zero so the error handling would
> break.  I changed it to int.

In declaration we use s32:
static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);

Doesn't it sound better to use s32 instead of int?

-- 
Rafał

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

* Re: [patch -next] bcma: signedness bug in bcma_get_next_core()
  2011-08-20 12:23 ` Rafał Miłecki
@ 2011-08-20 12:59   ` walter harms
  2011-08-20 13:31     ` Rafał Miłecki
  2011-08-23 19:13   ` Dan Carpenter
  2011-08-23 19:15   ` [patch -next v2] " Dan Carpenter
  2 siblings, 1 reply; 10+ messages in thread
From: walter harms @ 2011-08-20 12:59 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Dan Carpenter, open list:BROADCOM SPECIFIC..., kernel-janitors



Am 20.08.2011 14:23, schrieb Rafał Miłecki:
> W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
> <error27@gmail.com> napisał:
>> The u32 would never be less than zero so the error handling would
>> break.  I changed it to int.
> 
> In declaration we use s32:
> static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);
> 
> Doesn't it sound better to use s32 instead of int?
> 

aktualy int sounds better that s32 for me.

re,
 wh

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

* Re: [patch -next] bcma: signedness bug in bcma_get_next_core()
  2011-08-20 12:59   ` walter harms
@ 2011-08-20 13:31     ` Rafał Miłecki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-08-20 13:31 UTC (permalink / raw)
  To: wharms; +Cc: Dan Carpenter, open list:BROADCOM SPECIFIC..., kernel-janitors

W dniu 20 sierpnia 2011 14:59 użytkownik walter harms <wharms@bfs.de> napisał:
>
>
> Am 20.08.2011 14:23, schrieb Rafał Miłecki:
>> W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
>> <error27@gmail.com> napisał:
>>> The u32 would never be less than zero so the error handling would
>>> break.  I changed it to int.
>>
>> In declaration we use s32:
>> static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);
>>
>> Doesn't it sound better to use s32 instead of int?
>>
>
> aktualy int sounds better that s32 for me.

Will you care to replace function return type as well?

-- 
Rafał

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

* Re: [patch -next] bcma: signedness bug in bcma_get_next_core()
  2011-08-18 13:38 [patch -next] bcma: signedness bug in bcma_get_next_core() Dan Carpenter
  2011-08-20 12:23 ` Rafał Miłecki
@ 2011-08-20 14:11 ` walter harms
  2011-08-20 14:17 ` Rafał Miłecki
  2 siblings, 0 replies; 10+ messages in thread
From: walter harms @ 2011-08-20 14:11 UTC (permalink / raw)
  To: kernel-janitors



Am 20.08.2011 15:31, schrieb Rafał Miłecki:
> W dniu 20 sierpnia 2011 14:59 użytkownik walter harms <wharms@bfs.de> napisał:
>>
>>
>> Am 20.08.2011 14:23, schrieb Rafał Miłecki:
>>> W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
>>> <error27@gmail.com> napisał:
>>>> The u32 would never be less than zero so the error handling would
>>>> break.  I changed it to int.
>>>
>>> In declaration we use s32:
>>> static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);
>>>
>>> Doesn't it sound better to use s32 instead of int?
>>>
>>
>> aktualy int sounds better that s32 for me.
> 
> Will you care to replace function return type as well?
> 

not me, i would have to download a decent kernel etc, just to change
an s32 into int.

re,
 wh

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

* Re: [patch -next] bcma: signedness bug in bcma_get_next_core()
  2011-08-18 13:38 [patch -next] bcma: signedness bug in bcma_get_next_core() Dan Carpenter
  2011-08-20 12:23 ` Rafał Miłecki
  2011-08-20 14:11 ` [patch -next] " walter harms
@ 2011-08-20 14:17 ` Rafał Miłecki
  2 siblings, 0 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-08-20 14:17 UTC (permalink / raw)
  To: kernel-janitors

W dniu 20 sierpnia 2011 16:11 użytkownik walter harms <wharms@bfs.de> napisał:
>
>
> Am 20.08.2011 15:31, schrieb Rafał Miłecki:
>> W dniu 20 sierpnia 2011 14:59 użytkownik walter harms <wharms@bfs.de> napisał:
>>>
>>>
>>> Am 20.08.2011 14:23, schrieb Rafał Miłecki:
>>>> W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
>>>> <error27@gmail.com> napisał:
>>>>> The u32 would never be less than zero so the error handling would
>>>>> break.  I changed it to int.
>>>>
>>>> In declaration we use s32:
>>>> static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);
>>>>
>>>> Doesn't it sound better to use s32 instead of int?
>>>>
>>>
>>> aktualy int sounds better that s32 for me.
>>
>> Will you care to replace function return type as well?
>>
>
> not me, i would have to download a decent kernel etc, just to change
> an s32 into int.

Ups, sorry, replied too fast without checking the person I ask for.

Dan: can you change the function as well?

-- 
Rafał

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

* Re: [patch -next] bcma: signedness bug in bcma_get_next_core()
  2011-08-20 12:23 ` Rafał Miłecki
  2011-08-20 12:59   ` walter harms
@ 2011-08-23 19:13   ` Dan Carpenter
  2011-08-24 10:01     ` Rafał Miłecki
  2011-08-23 19:15   ` [patch -next v2] " Dan Carpenter
  2 siblings, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2011-08-23 19:13 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: open list:BROADCOM SPECIFIC..., kernel-janitors

On Sat, Aug 20, 2011 at 02:23:56PM +0200, Rafał Miłecki wrote:
> W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
> <error27@gmail.com> napisał:
> > The u32 would never be less than zero so the error handling would
> > break.  I changed it to int.
> 
> In declaration we use s32:
> static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);
> 
> Doesn't it sound better to use s32 instead of int?
>

I don't know.  I think I'm going to trust the original author on this
one.  I'll send you a v2 that uses s32.

regards,
dan carpenter


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

* [patch -next v2] bcma: signedness bug in bcma_get_next_core()
  2011-08-20 12:23 ` Rafał Miłecki
  2011-08-20 12:59   ` walter harms
  2011-08-23 19:13   ` Dan Carpenter
@ 2011-08-23 19:15   ` Dan Carpenter
  2 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2011-08-23 19:15 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: open list:BROADCOM SPECIFIC..., kernel-janitors

The u32 would never be less than zero so the error handling would
break.  I changed it to s32 to match how bcma_erom_get_mst_port() is
declared.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
v2:  the first version used "int" instead of "s32".

diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index 0ea390f..cad9948 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -281,7 +281,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
 
 	/* get & parse master ports */
 	for (i = 0; i < ports[0]; i++) {
-		u32 mst_port_d = bcma_erom_get_mst_port(bus, eromptr);
+		s32 mst_port_d = bcma_erom_get_mst_port(bus, eromptr);
 		if (mst_port_d < 0)
 			return -EILSEQ;
 	}

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

* Re: [patch -next] bcma: signedness bug in bcma_get_next_core()
  2011-08-23 19:13   ` Dan Carpenter
@ 2011-08-24 10:01     ` Rafał Miłecki
  2011-08-24 10:17       ` Dan Carpenter
  0 siblings, 1 reply; 10+ messages in thread
From: Rafał Miłecki @ 2011-08-24 10:01 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: open list:BROADCOM SPECIFIC..., kernel-janitors

W dniu 23 sierpnia 2011 21:13 użytkownik Dan Carpenter
<error27@gmail.com> napisał:
> On Sat, Aug 20, 2011 at 02:23:56PM +0200, Rafał Miłecki wrote:
>> W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
>> <error27@gmail.com> napisał:
>> > The u32 would never be less than zero so the error handling would
>> > break.  I changed it to int.
>>
>> In declaration we use s32:
>> static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);
>>
>> Doesn't it sound better to use s32 instead of int?
>>
>
> I don't know.  I think I'm going to trust the original author on this
> one.  I'll send you a v2 that uses s32.

Dan, I asked you to use int in both: call and function declaration.
I'm the author of that code, and I don't have anything against
modifying that :)

I think int is used much more often that s32 for errors.

-- 
Rafał

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

* Re: [patch -next] bcma: signedness bug in bcma_get_next_core()
  2011-08-24 10:01     ` Rafał Miłecki
@ 2011-08-24 10:17       ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2011-08-24 10:17 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: open list:BROADCOM SPECIFIC..., kernel-janitors

On Wed, Aug 24, 2011 at 12:01:11PM +0200, Rafał Miłecki wrote:
> Dan, I asked you to use int in both: call and function declaration.
> I'm the author of that code, and I don't have anything against
> modifying that :)
> 
> I think int is used much more often that s32 for errors.
> 

No problem.  Should I make bcma_erom_get_mst_port() return 0 on
success while I'm at it?

regards,
dan carpenter


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

end of thread, other threads:[~2011-08-24 10:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-18 13:38 [patch -next] bcma: signedness bug in bcma_get_next_core() Dan Carpenter
2011-08-20 12:23 ` Rafał Miłecki
2011-08-20 12:59   ` walter harms
2011-08-20 13:31     ` Rafał Miłecki
2011-08-23 19:13   ` Dan Carpenter
2011-08-24 10:01     ` Rafał Miłecki
2011-08-24 10:17       ` Dan Carpenter
2011-08-23 19:15   ` [patch -next v2] " Dan Carpenter
2011-08-20 14:11 ` [patch -next] " walter harms
2011-08-20 14:17 ` Rafał Miłecki

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