[PATCH] fix cid 1350010
Michael Adam
obnox at samba.org
Wed Feb 3 12:43:28 UTC 2016
On 2016-02-03 at 13:39 +0100, Volker Lendecke wrote:
> On Wed, Feb 03, 2016 at 11:32:21AM +0100, Michael Adam wrote:
> > From ce60d79e6475b1c4189166bb1a54a2a2c87874f6 Mon Sep 17 00:00:00 2001
> > From: Michael Adam <obnox at samba.org>
> > Date: Wed, 3 Feb 2016 11:28:32 +0100
> > Subject: [PATCH] lib:socket: fix CID 1350010 - integer OVERFLOW_BEFORE_WIDEN
> >
> > Signed-off-by: Michael Adam <obnox at samba.org>
> > ---
> > lib/socket/interfaces.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/socket/interfaces.c b/lib/socket/interfaces.c
> > index 98341e2..f0386c0 100644
> > --- a/lib/socket/interfaces.c
> > +++ b/lib/socket/interfaces.c
> > @@ -160,7 +160,7 @@ static void query_iface_speed_from_name(const char *name, uint64_t *speed)
> > if (ret == -1) {
> > goto done;
> > }
> > - *speed = (ethtool_cmd_speed(&ecmd)) * 1000 * 1000;
> > + *speed = (uint64_t)(ethtool_cmd_speed(&ecmd)) * 1000 * 1000;
>
> Wouldn't ((uint64_t)ethtool_cmd_speed(&ecmd)) be more appropriate?
> Just for clarity?
Oh, indeed!
Updated patch attached.
Thanks - Michael
-------------- next part --------------
From bf50fd88110c5b9f599dd96133645a35123a2be0 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 3 Feb 2016 11:28:32 +0100
Subject: [PATCH] lib:socket: fix CID 1350010 - integer OVERFLOW_BEFORE_WIDEN
Signed-off-by: Michael Adam <obnox at samba.org>
---
lib/socket/interfaces.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/socket/interfaces.c b/lib/socket/interfaces.c
index 98341e2..cf094f0 100644
--- a/lib/socket/interfaces.c
+++ b/lib/socket/interfaces.c
@@ -160,7 +160,7 @@ static void query_iface_speed_from_name(const char *name, uint64_t *speed)
if (ret == -1) {
goto done;
}
- *speed = (ethtool_cmd_speed(&ecmd)) * 1000 * 1000;
+ *speed = ((uint64_t)ethtool_cmd_speed(&ecmd)) * 1000 * 1000;
done:
(void)close(fd);
--
2.5.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160203/4d1cc384/signature.sig>
More information about the samba-technical
mailing list