From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] IB/bnxt_re: Check return value from get_link_ksettings
Date: Mon, 5 Jun 2017 15:54:15 +0300 [thread overview]
Message-ID: <20170605125415.GN6868@mtr-leonro.local> (raw)
In-Reply-To: <20170605125227.GM6868-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1931 bytes --]
On Mon, Jun 05, 2017 at 03:52:27PM +0300, Leon Romanovsky wrote:
> On Mon, Jun 05, 2017 at 12:14:29PM +0300, Yuval Shaia wrote:
> > The function get_link_ksettings might return bad status indicating a
> > failure to retrieve interface atttibutes.
> > Check return value to cover this case.
> >
> > While there, change the zero-initialization to "compiler-helper" instead
> > of an expensive call to memcpy.
> >
> > Signed-off-by: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> > ---
> > drivers/infiniband/hw/bnxt_re/ib_verbs.c | 16 +++++++++-------
> > 1 file changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > index 7ba9e69..10c7189 100644
> > --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > @@ -183,17 +183,19 @@ int bnxt_re_modify_device(struct ib_device *ibdev,
> >
> > static void __to_ib_speed_width(struct net_device *netdev, u8 *speed, u8 *width)
> > {
> > - struct ethtool_link_ksettings lksettings;
> > - u32 espeed;
> > + u32 espeed = SPEED_UNKNOWN;
> >
> > if (netdev->ethtool_ops && netdev->ethtool_ops->get_link_ksettings) {
> > - memset(&lksettings, 0, sizeof(lksettings));
> > + struct ethtool_link_ksettings lksettings = {0};
> > + int rc;
> > +
> > rtnl_lock();
> > - netdev->ethtool_ops->get_link_ksettings(netdev, &lksettings);
> > + rc = netdev->ethtool_ops->get_link_ksettings(netdev,
> > + &lksettings);
> > rtnl_unlock();
> > - espeed = lksettings.base.speed;
> > - } else {
> > - espeed = SPEED_UNKNOWN;
> > +
> > + if (!rc)
>
> Are you sure that it is "if (!rc)" and not "if (rc)"?
> in commit message you wrote that "The function get_link_ksettings might
> return bad status indicating".
Sorry, you are right.
Thanks,
Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-06-05 12:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 9:14 [PATCH] IB/bnxt_re: Check return value from get_link_ksettings Yuval Shaia
[not found] ` <20170605091429.16232-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-06-05 10:42 ` Moni Shoua
[not found] ` <CAG9sBKODJaecc2m-GTqU8H=jttPAr+iCcZK0wknEfXerz6TL+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-05 12:42 ` Yuval Shaia
2017-06-05 13:38 ` Leon Romanovsky
[not found] ` <20170605133831.GO6868-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-06-05 14:30 ` Yuval Shaia
2017-06-05 15:04 ` Moni Shoua
[not found] ` <CAG9sBKPkW9kedMUTOYPESUm8gJkYk4vRSuC3amOCNa+fHEnw+g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-06 11:30 ` Yuval Shaia
2017-06-05 12:52 ` Leon Romanovsky
[not found] ` <20170605125227.GM6868-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-06-05 12:54 ` Leon Romanovsky [this message]
[not found] ` <20170605125415.GN6868-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-06-05 13:33 ` Yuval Shaia
2017-06-05 13:11 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170605125415.GN6868@mtr-leonro.local \
--to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox