From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andreas Noever <andreas.noever@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
Yehezkel Bernat <yehezkel.bernat@intel.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] thunderbolt: Fix some right shifting to zero bugs
Date: Fri, 13 Oct 2017 11:42:10 +0000 [thread overview]
Message-ID: <20171013114210.GE2761@lahna.fi.intel.com> (raw)
In-Reply-To: <20171013112959.sc2pwazrpk7fxbtw@mwanda>
On Fri, Oct 13, 2017 at 02:29:59PM +0300, Dan Carpenter wrote:
> The problematic code looks like this:
>
> res_seq = res_hdr->xd_hdr.length_sn & TB_XDOMAIN_SN_MASK;
> res_seq >>= TB_XDOMAIN_SN_SHIFT;
>
> TB_XDOMAIN_SN_SHIFT is 27, and right shifting a u8 27 bits is always
> going to result in zero. The fix is to declare these variables as u32.
>
> Fixes: d1ff70241a27 ("thunderbolt: Add support for XDomain discovery protocol")
I think this requires two patches as the drivers/net/thunderbolt.c is
added by another commit.
Also please CC netdev@vger.kernel.org and David Miller as the patches
are in his net-next tree.
The fixes themselves look good, though.
WARNING: multiple messages have this Message-ID (diff)
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andreas Noever <andreas.noever@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
Yehezkel Bernat <yehezkel.bernat@intel.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] thunderbolt: Fix some right shifting to zero bugs
Date: Fri, 13 Oct 2017 14:42:10 +0300 [thread overview]
Message-ID: <20171013114210.GE2761@lahna.fi.intel.com> (raw)
In-Reply-To: <20171013112959.sc2pwazrpk7fxbtw@mwanda>
On Fri, Oct 13, 2017 at 02:29:59PM +0300, Dan Carpenter wrote:
> The problematic code looks like this:
>
> res_seq = res_hdr->xd_hdr.length_sn & TB_XDOMAIN_SN_MASK;
> res_seq >>= TB_XDOMAIN_SN_SHIFT;
>
> TB_XDOMAIN_SN_SHIFT is 27, and right shifting a u8 27 bits is always
> going to result in zero. The fix is to declare these variables as u32.
>
> Fixes: d1ff70241a27 ("thunderbolt: Add support for XDomain discovery protocol")
I think this requires two patches as the drivers/net/thunderbolt.c is
added by another commit.
Also please CC netdev@vger.kernel.org and David Miller as the patches
are in his net-next tree.
The fixes themselves look good, though.
next prev parent reply other threads:[~2017-10-13 11:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 11:29 [PATCH] thunderbolt: Fix some right shifting to zero bugs Dan Carpenter
2017-10-13 11:29 ` Dan Carpenter
2017-10-13 11:42 ` Mika Westerberg [this message]
2017-10-13 11:42 ` Mika Westerberg
2017-10-17 12:32 ` [PATCH 1/2 v2 net-next] thunderbolt: Fix a couple " Dan Carpenter
2017-10-17 12:32 ` Dan Carpenter
2017-10-19 12:04 ` David Miller
2017-10-19 12:04 ` David Miller
2017-10-17 12:33 ` [PATCH 2/2 net-next] thunderbolt: Right shifting to zero bug in tbnet_handle_packet() Dan Carpenter
2017-10-17 12:33 ` Dan Carpenter
2017-10-17 13:17 ` Bernat, Yehezkel
2017-10-17 13:17 ` Bernat, Yehezkel
2017-10-19 12:05 ` David Miller
2017-10-19 12:05 ` David Miller
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=20171013114210.GE2761@lahna.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=andreas.noever@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.jamet@intel.com \
--cc=yehezkel.bernat@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.