Patch "drm/amd/display: fix overflow on MIN_I64 definition" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/amd/display: fix overflow on MIN_I64 definition

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-amd-display-fix-overflow-on-min_i64-definition.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 77ef1f27ce6143fc6e4c353cd3f857a3030be1bd
Author: David Gow <davidgow@xxxxxxxxxx>
Date:   Thu Aug 11 17:43:26 2022 -0300

    drm/amd/display: fix overflow on MIN_I64 definition
    
    [ Upstream commit 6ae0632d17759852c07e2d1e0a31c728eb6ba246 ]
    
    The definition of MIN_I64 in bw_fixed.c can cause gcc to whinge about
    integer overflow, because it is treated as a positive value, which is
    then negated. The temporary positive value is not necessarily
    representable.
    
    This causes the following warning:
    ../drivers/gpu/drm/amd/amdgpu/../display/dc/dml/calcs/bw_fixed.c:30:19:
    warning: integer overflow in expression ‘-9223372036854775808’ of type
    ‘long long int’ results in ‘-9223372036854775808’ [-Woverflow]
      30 |         (int64_t)(-(1LL << 63))
         |                   ^
    
    Writing out (-MAX_I64 - 1) works instead.
    
    Signed-off-by: David Gow <davidgow@xxxxxxxxxx>
    Signed-off-by: Tales Aparecida <tales.aparecida@xxxxxxxxx>
    Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c
index 6ca288fb5fb9..2d46bc527b21 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c
@@ -26,12 +26,12 @@
 #include "bw_fixed.h"
 
 
-#define MIN_I64 \
-	(int64_t)(-(1LL << 63))
-
 #define MAX_I64 \
 	(int64_t)((1ULL << 63) - 1)
 
+#define MIN_I64 \
+	(-MAX_I64 - 1)
+
 #define FRACTIONAL_PART_MASK \
 	((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1)
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux