Blame SOURCES/0035-v4l2-avoid-shifting-left-a-signed-number-by-31-bit.patch
|
|
4d44fe |
From 91281fec7823f1cd3df3374fbcbd14af52a3fa1b Mon Sep 17 00:00:00 2001
|
|
|
4d44fe |
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
|
|
4d44fe |
Date: Wed, 14 Aug 2019 17:15:47 +0200
|
|
|
4d44fe |
Subject: [PATCH] v4l2: avoid shifting left a signed number by 31 bit
|
|
|
4d44fe |
|
|
|
4d44fe |
cppcheck warns about it with the following diagnostics:
|
|
|
4d44fe |
|
|
|
4d44fe |
error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is
|
|
|
4d44fe |
undefined behaviour
|
|
|
4d44fe |
|
|
|
4d44fe |
* v4l2.c [!v4l2_fourcc_be] (v4l2_fourcc_be): Shift left 1U and not 1 in
|
|
|
4d44fe |
order to get 0x80000000.
|
|
|
4d44fe |
---
|
|
|
4d44fe |
v4l2.c | 2 +-
|
|
|
4d44fe |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
4d44fe |
|
|
|
4d44fe |
diff --git a/v4l2.c b/v4l2.c
|
|
|
4d44fe |
index 5da457c..505e7b8 100644
|
|
|
4d44fe |
--- a/v4l2.c
|
|
|
4d44fe |
+++ b/v4l2.c
|
|
|
4d44fe |
@@ -47,7 +47,7 @@ typedef struct v4l2_standard struct_v4l2_standard;
|
|
|
4d44fe |
|
|
|
4d44fe |
/* v4l2_fourcc_be was added by Linux commit v3.18-rc1~101^2^2~127 */
|
|
|
4d44fe |
#ifndef v4l2_fourcc_be
|
|
|
4d44fe |
-# define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1 << 31))
|
|
|
4d44fe |
+# define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1U << 31))
|
|
|
4d44fe |
#endif
|
|
|
4d44fe |
|
|
|
4d44fe |
#define FMT_FRACT "%u/%u"
|
|
|
4d44fe |
--
|
|
|
4d44fe |
2.1.4
|
|
|
4d44fe |
|