media: v4l: Avoid unaligned access warnings when printing 4cc modifiers
authorSakari Ailus <sakari.ailus@linux.intel.com>
Mon, 10 Jan 2022 14:53:12 +0000 (15:53 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 28 Jan 2022 18:32:49 +0000 (19:32 +0100)
commit24bb30c8c894ec7213ad810b46e2a6a4c12136c1
tree8de8ccdbe71c14d4667b7de77c089c026549563b
parentc748f10c213cca53ad5c761034aa0e45d2572740
media: v4l: Avoid unaligned access warnings when printing 4cc modifiers

Pointers V4L2 pixelformat and dataformat fields in a few packed structs
are directly passed to printk family of functions. This could result in an
unaligned access albeit no such possibility appears to exist at the
moment i.e. this clang warning appears to be a false positive.

Address the warning by copying the pixelformat or dataformat value to a
local variable first.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: e927e1e0f0dd ("v4l: ioctl: Use %p4cc printk modifier to print FourCC codes")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/v4l2-core/v4l2-ioctl.c