public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Shobhit Kukreti <shobhitkukreti@gmail.com>
To: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	skhan@linuxfoundation.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Cc: shobhitkukreti@gmail.com
Subject: [PATCH] video: radeon.h Fix Shifting signed 32 bit value by 31 bits problem
Date: Sat, 6 Jul 2019 11:41:14 -0700	[thread overview]
Message-ID: <20190706184111.GA13070@t-1000> (raw)

Fix RB2D_DC_BUSY and HORZ_AUTO_RATIO_INC defines to use "U" cast to
avoid shifting signed 32 bit values by 31 bit problem. This is not a
problem for gcc built kernel.

However, the header file being a public api, other compilers may not
handle the condition safely resulting in undefined behavior.

Signed-off-by: Shobhit Kukreti <shobhitkukreti@gmail.com>
---
 include/video/radeon.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/video/radeon.h b/include/video/radeon.h
index 005eae1..cb0a5f6 100644
--- a/include/video/radeon.h
+++ b/include/video/radeon.h
@@ -531,7 +531,7 @@
 #define RB2D_DC_FLUSH_2D			   (1 << 0)
 #define RB2D_DC_FREE_2D				   (1 << 2)
 #define RB2D_DC_FLUSH_ALL			   (RB2D_DC_FLUSH_2D | RB2D_DC_FREE_2D)
-#define RB2D_DC_BUSY				   (1 << 31)
+#define RB2D_DC_BUSY				   (1U << 31)
 
 /* DSTCACHE_MODE bits constants */
 #define RB2D_DC_AUTOFLUSH_ENABLE                   (1 << 8)
@@ -672,7 +672,7 @@
 #define HORZ_STRETCH_ENABLE			   (1 << 25)
 #define HORZ_AUTO_RATIO				   (1 << 27)
 #define HORZ_FP_LOOP_STRETCH			   (0x7 << 28)
-#define HORZ_AUTO_RATIO_INC			   (1 << 31)
+#define HORZ_AUTO_RATIO_INC			   (1U << 31)
 
 
 /* FP_VERT_STRETCH bit constants */
-- 
2.7.4


             reply	other threads:[~2019-07-06 18:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190706184121epcas2p3e9f8717c9e809f7756b1dfa4665ce1c2@epcas2p3.samsung.com>
2019-07-06 18:41 ` Shobhit Kukreti [this message]
2019-07-15 11:34   ` [PATCH] video: radeon.h Fix Shifting signed 32 bit value by 31 bits problem Bartlomiej Zolnierkiewicz
2019-07-22  1:14     ` [PATCH v2] " Shobhit Kukreti
2019-08-19 14:33       ` Bartlomiej Zolnierkiewicz

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=20190706184111.GA13070@t-1000 \
    --to=shobhitkukreti@gmail.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@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