kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] block, sx8: fix pointer math issue getting fw version
@ 2012-03-02 19:00 Dan Carpenter
  2012-03-03  6:58 ` Jens Axboe
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2012-03-02 19:00 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Tejun Heo, Jens Axboe, linux-kernel, kernel-janitors

"mem" is type u8.  We need parenthesis here or it screws up the pointer
math probably leading to an oops.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index e7472f5..3fb6ab4 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -1120,7 +1120,7 @@ static inline void carm_handle_resp(struct carm_host *host,
 			break;
 		case MISC_GET_FW_VER: {
 			struct carm_fw_ver *ver = (struct carm_fw_ver *)
-				mem + sizeof(struct carm_msg_get_fw_ver);
+				(mem + sizeof(struct carm_msg_get_fw_ver));
 			if (!error) {
 				host->fw_ver = le32_to_cpu(ver->version);
 				host->flags |= (ver->features & FL_FW_VER_MASK);

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

* Re: [patch] block, sx8: fix pointer math issue getting fw version
  2012-03-02 19:00 [patch] block, sx8: fix pointer math issue getting fw version Dan Carpenter
@ 2012-03-03  6:58 ` Jens Axboe
  2012-03-03  7:00   ` Jens Axboe
  2012-03-03 17:10   ` Jeff Garzik
  0 siblings, 2 replies; 7+ messages in thread
From: Jens Axboe @ 2012-03-03  6:58 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jeff Garzik, Tejun Heo, linux-kernel, kernel-janitors

On 2012-03-02 20:00, Dan Carpenter wrote:
> "mem" is type u8.  We need parenthesis here or it screws up the pointer
> math probably leading to an oops.

Applied, thanks Dan. I have marked it stable, too.

-- 
Jens Axboe


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

* Re: [patch] block, sx8: fix pointer math issue getting fw version
  2012-03-03  6:58 ` Jens Axboe
@ 2012-03-03  7:00   ` Jens Axboe
  2012-03-03  8:04     ` Dan Carpenter
  2012-03-03 17:10   ` Jeff Garzik
  1 sibling, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2012-03-03  7:00 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jeff Garzik, Tejun Heo, linux-kernel, kernel-janitors

On 2012-03-03 07:58, Jens Axboe wrote:
> On 2012-03-02 20:00, Dan Carpenter wrote:
>> "mem" is type u8.  We need parenthesis here or it screws up the pointer
>> math probably leading to an oops.
> 
> Applied, thanks Dan. I have marked it stable, too.

Hmm wait Dan, seems to me that u8 pointer math should be equiv to char *
pointer math and hence it'd work just fine. Are you sure this is a bug?

-- 
Jens Axboe


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

* Re: [patch] block, sx8: fix pointer math issue getting fw version
  2012-03-03  7:00   ` Jens Axboe
@ 2012-03-03  8:04     ` Dan Carpenter
  2012-03-03 11:08       ` Jens Axboe
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2012-03-03  8:04 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Jeff Garzik, Tejun Heo, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

On Sat, Mar 03, 2012 at 08:00:28AM +0100, Jens Axboe wrote:
> On 2012-03-03 07:58, Jens Axboe wrote:
> > On 2012-03-02 20:00, Dan Carpenter wrote:
> >> "mem" is type u8.  We need parenthesis here or it screws up the pointer
> >> math probably leading to an oops.
> > 
> > Applied, thanks Dan. I have marked it stable, too.
> 
> Hmm wait Dan, seems to me that u8 pointer math should be equiv to char *
> pointer math and hence it'd work just fine. Are you sure this is a bug?

It's the cast on the line before is what breaks it.  We need the
parentheses so we add first then cast the result.

regards,
dan carpenter


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [patch] block, sx8: fix pointer math issue getting fw version
  2012-03-03  8:04     ` Dan Carpenter
@ 2012-03-03 11:08       ` Jens Axboe
  0 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2012-03-03 11:08 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jeff Garzik, Tejun Heo, linux-kernel, kernel-janitors

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 2012-03-03 09:04, Dan Carpenter wrote:
> On Sat, Mar 03, 2012 at 08:00:28AM +0100, Jens Axboe wrote:
>> On 2012-03-03 07:58, Jens Axboe wrote:
>>> On 2012-03-02 20:00, Dan Carpenter wrote:
>>>> "mem" is type u8.  We need parenthesis here or it screws up the pointer
>>>> math probably leading to an oops.
>>>
>>> Applied, thanks Dan. I have marked it stable, too.
>>
>> Hmm wait Dan, seems to me that u8 pointer math should be equiv to char *
>> pointer math and hence it'd work just fine. Are you sure this is a bug?
> 
> It's the cast on the line before is what breaks it.  We need the
> parentheses so we add first then cast the result.

Ah indeed, missed that. Thanks!

- -- 
Jens Axboe

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCAAGBQJPUfuYAAoJEPfTWPspceCm05AQAKfdxDDY2roFrTcOE5u0wKgL
UHXWmliwZAZLKbX939KdXHtnIhT3ylymRlRGAevGvp76GkjjRD1uaXywa3RPCG50
Ri3lOfUmXwQj5GJSmreFApvErMd2hKKTV3ARMtspd5HsAoABNHq+lrhXMsW90/hT
fa4IPjvKXP64FKKXmfr/MQ8d1bAVcYwvkfZsps2KS8Uj8EUr42AZt6bKMa0EOxxs
swgc3lQ2cwV+BmdjHTApkhH9lTzlot9bchPXYcPGDfWAtFO/MdrZ6ZNsR0Ak3LAN
0OOATReL5uupRgiHiHEJtym2jLSKc0RfJnU5qpgp5S9+Qbc5/j2Lt6M2yHysnTsW
POprT18pOm7lIPhdOCcSy55gW+UxVIWbqAr/5KuZNa1fAZxtghpPRQUOjkJhCdZV
vaFgoQCwDKZ5bjfWZ3NJxY5Di87M9JKyYrgh1XmmLInRqC4iBi5IdLdi54TmMJBo
pqLTFnDy1NaCf4E4xQqxuRTKcJyHt8QToMb2infP2Mz++jGZpygkiCUtIZwiDmq/
/J8MS9y2pNJDIZn71pyBIEQkgSXjerLqc5gEbUsszXo5w22r/VtR3PzVWGIK59Wq
RXhShLaLD7fPVpnlIVcoivv7O9EDXaEwFlqRI4mt68PGndmFcqWLFeV/8mbHP5ce
VZg3X+JY9CNxL4xvqGhb
=ORht
-----END PGP SIGNATURE-----

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

* Re: [patch] block, sx8: fix pointer math issue getting fw version
  2012-03-03  6:58 ` Jens Axboe
  2012-03-03  7:00   ` Jens Axboe
@ 2012-03-03 17:10   ` Jeff Garzik
  2012-03-03 18:44     ` Jens Axboe
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2012-03-03 17:10 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Dan Carpenter, Tejun Heo, linux-kernel, kernel-janitors

On 03/03/2012 01:58 AM, Jens Axboe wrote:
> On 2012-03-02 20:00, Dan Carpenter wrote:
>> "mem" is type u8.  We need parenthesis here or it screws up the pointer
>> math probably leading to an oops.
>
> Applied, thanks Dan. I have marked it stable, too.

Please add Acked-by: Jeff Garzik <jgarzik@redhat.com>

It is rather obscure hardware, but I do still maintain the driver :)




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

* Re: [patch] block, sx8: fix pointer math issue getting fw version
  2012-03-03 17:10   ` Jeff Garzik
@ 2012-03-03 18:44     ` Jens Axboe
  0 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2012-03-03 18:44 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Dan Carpenter, Tejun Heo, linux-kernel, kernel-janitors

On 2012-03-03 18:10, Jeff Garzik wrote:
> On 03/03/2012 01:58 AM, Jens Axboe wrote:
>> On 2012-03-02 20:00, Dan Carpenter wrote:
>>> "mem" is type u8.  We need parenthesis here or it screws up the pointer
>>> math probably leading to an oops.
>>
>> Applied, thanks Dan. I have marked it stable, too.
> 
> Please add Acked-by: Jeff Garzik <jgarzik@redhat.com>
> 
> It is rather obscure hardware, but I do still maintain the driver :)

Sure, added. I still have one in my drawer, btw, but it hasn't been
hooked up in ages :-)

-- 
Jens Axboe


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

end of thread, other threads:[~2012-03-03 18:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-02 19:00 [patch] block, sx8: fix pointer math issue getting fw version Dan Carpenter
2012-03-03  6:58 ` Jens Axboe
2012-03-03  7:00   ` Jens Axboe
2012-03-03  8:04     ` Dan Carpenter
2012-03-03 11:08       ` Jens Axboe
2012-03-03 17:10   ` Jeff Garzik
2012-03-03 18:44     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).