atm: zatm: fix memcmp casting
authorIvan Bornyakov <brnkv.i1@gmail.com>
Fri, 25 May 2018 17:49:52 +0000 (20:49 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 May 2018 13:59:53 +0000 (09:59 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/atm/zatm.c

index 9c9a229587176d560419c0c9c4df9562c1279a75..a8d2eb0ceb8d8f78788182f81f8e1e9f9dc8fbbb 100644 (file)
@@ -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;