Patch "drm/fourcc: fix integer type usage in uapi header" has been added to the 5.18-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/fourcc: fix integer type usage in uapi header

to the 5.18-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-fourcc-fix-integer-type-usage-in-uapi-header.patch
and it can be found in the queue-5.18 subdirectory.

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



commit 3119d6ddb481ab153504b3b3146ca16a4a1bcc8e
Author: Carlos Llamas <cmllamas@xxxxxxxxxx>
Date:   Tue Jun 21 20:39:21 2022 +0000

    drm/fourcc: fix integer type usage in uapi header
    
    [ Upstream commit 20b8264394b33adb1640a485a62a84bc1388b6a3 ]
    
    Kernel uapi headers are supposed to use __[us]{8,16,32,64} types defined
    by <linux/types.h> as opposed to 'uint32_t' and similar. See [1] for the
    relevant discussion about this topic. In this particular case, the usage
    of 'uint64_t' escaped headers_check as these macros are not being called
    here. However, the following program triggers a compilation error:
    
      #include <drm/drm_fourcc.h>
    
      int main()
      {
            unsigned long x = AMD_FMT_MOD_CLEAR(RB);
            return 0;
      }
    
    gcc error:
      drm.c:5:27: error: ‘uint64_t’ undeclared (first use in this function)
          5 |         unsigned long x = AMD_FMT_MOD_CLEAR(RB);
            |                           ^~~~~~~~~~~~~~~~~
    
    This patch changes AMD_FMT_MOD_{SET,CLEAR} macros to use the correct
    integer types, which fixes the above issue.
    
      [1] https://lkml.org/lkml/2019/6/5/18
    
    Fixes: 8ba16d599374 ("drm/fourcc: Add AMD DRM modifiers.")
    Signed-off-by: Carlos Llamas <cmllamas@xxxxxxxxxx>
    Reviewed-by: Simon Ser <contact@xxxxxxxxxxx>
    Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index fc0c1454d275..7b9e3f9a0f00 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -1375,11 +1375,11 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
 #define AMD_FMT_MOD_PIPE_MASK 0x7
 
 #define AMD_FMT_MOD_SET(field, value) \
-	((uint64_t)(value) << AMD_FMT_MOD_##field##_SHIFT)
+	((__u64)(value) << AMD_FMT_MOD_##field##_SHIFT)
 #define AMD_FMT_MOD_GET(field, value) \
 	(((value) >> AMD_FMT_MOD_##field##_SHIFT) & AMD_FMT_MOD_##field##_MASK)
 #define AMD_FMT_MOD_CLEAR(field) \
-	(~((uint64_t)AMD_FMT_MOD_##field##_MASK << AMD_FMT_MOD_##field##_SHIFT))
+	(~((__u64)AMD_FMT_MOD_##field##_MASK << AMD_FMT_MOD_##field##_SHIFT))
 
 #if defined(__cplusplus)
 }



[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