LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] atm: zatm: fix memcmp casting
@ 2018-05-25 17:49 Ivan Bornyakov
2018-05-29 14:00 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ivan Bornyakov @ 2018-05-25 17:49 UTC (permalink / raw)
To: 3chas3; +Cc: linux-atm-general, netdev, linux-kernel, Ivan Bornyakov
memcmp() returns int, but eprom_try_esi() cast it to unsigned char. One
can lose significant bits and get 0 from non-0 value returned by the
memcmp().
Signed-off-by: Ivan Bornyakov <brnkv.i1@gmail.com>
---
drivers/atm/zatm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 9c9a22958717..a8d2eb0ceb8d 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -1151,8 +1151,8 @@ static void eprom_get_byte(struct zatm_dev *zatm_dev, unsigned char *byte,
}
-static unsigned char eprom_try_esi(struct atm_dev *dev, unsigned short cmd,
- int offset, int swap)
+static int eprom_try_esi(struct atm_dev *dev, unsigned short cmd, int offset,
+ int swap)
{
unsigned char buf[ZEPROM_SIZE];
struct zatm_dev *zatm_dev;
--
2.16.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] atm: zatm: fix memcmp casting
2018-05-25 17:49 [PATCH] atm: zatm: fix memcmp casting Ivan Bornyakov
@ 2018-05-29 14:00 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-05-29 14:00 UTC (permalink / raw)
To: brnkv.i1; +Cc: 3chas3, linux-atm-general, netdev, linux-kernel
From: Ivan Bornyakov <brnkv.i1@gmail.com>
Date: Fri, 25 May 2018 20:49:52 +0300
> memcmp() returns int, but eprom_try_esi() cast it to unsigned char. One
> can lose significant bits and get 0 from non-0 value returned by the
> memcmp().
>
> Signed-off-by: Ivan Bornyakov <brnkv.i1@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-29 14:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-25 17:49 [PATCH] atm: zatm: fix memcmp casting Ivan Bornyakov
2018-05-29 14:00 ` David Miller
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).