public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiunn Chang <c0d1n61at3@gmail.com>
To: skhan@linuxfoundation.org
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net
Subject: [Linux-kernel-mentees][PATCH v3] packet: Fix undefined behavior in bit shift
Date: Thu, 27 Jun 2019 00:04:24 -0500	[thread overview]
Message-ID: <20190627050426.17925-1-c0d1n61at3@gmail.com> (raw)
In-Reply-To: <20190627032532.18374-2-c0d1n61at3@gmail.com>

Shifting signed 32-bit value by 31 bits is undefined.  Changing most
significant bit to unsigned.

Signed-off-by: Jiunn Chang <c0d1n61at3@gmail.com>
---
Changes included in v3:
  - remove change log from patch description

Changes included in v2:
  - use subsystem specific subject lines
  - CC required mailing lists

 include/uapi/linux/if_packet.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h
index 467b654bd4c7..3d884d68eb30 100644
--- a/include/uapi/linux/if_packet.h
+++ b/include/uapi/linux/if_packet.h
@@ -123,7 +123,7 @@ struct tpacket_auxdata {
 /* Rx and Tx ring - header status */
 #define TP_STATUS_TS_SOFTWARE		(1 << 29)
 #define TP_STATUS_TS_SYS_HARDWARE	(1 << 30) /* deprecated, never set */
-#define TP_STATUS_TS_RAW_HARDWARE	(1 << 31)
+#define TP_STATUS_TS_RAW_HARDWARE	(1U << 31)
 
 /* Rx ring - feature request bits */
 #define TP_FT_REQ_FILL_RXHASH	0x1
-- 
2.22.0


  parent reply	other threads:[~2019-06-27  5:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190627010137.5612-1-c0d1n61at3@gmail.com>
2019-06-27  3:25 ` [Linux-kernel-mentees][PATCH v2] packet: Fix undefined behavior in bit shift Jiunn Chang
2019-06-27  3:32   ` Shuah Khan
2019-06-27 16:22     ` David Miller
2019-06-27 16:52       ` Shuah Khan
2019-06-27 17:05         ` Alexei Starovoitov
2019-06-27 17:08           ` Shuah Khan
2019-06-27 16:57       ` Jiunn Chang
2019-06-27 17:34         ` David Miller
2019-06-27  5:04   ` Jiunn Chang [this message]
2019-06-29 18:06   ` 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=20190627050426.17925-1-c0d1n61at3@gmail.com \
    --to=c0d1n61at3@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=skhan@linuxfoundation.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