]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 11:57:43 +0000 (13:57 +0200)
commite745922a4018b7f2529d5ff128979d333d18cbcf
tree1072a0d10067be5ae88a026200ecc973086e3765
parentbd938c06c4968008027a58bdae5bdf6e4687d795
media: v4l: Avoid unaligned access warnings when printing 4cc modifiers

[ Upstream commit 24bb30c8c894ec7213ad810b46e2a6a4c12136c1 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/v4l2-core/v4l2-ioctl.c