]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
cxl/fwctl: Fix __fortify_panic
authorDan Williams <djbw@kernel.org>
Tue, 19 May 2026 22:12:03 +0000 (15:12 -0700)
committerDave Jiang <dave.jiang@intel.com>
Thu, 4 Jun 2026 15:44:00 +0000 (08:44 -0700)
commit6c9d2e87df40d606f1c85143e9acb1ecff463d5e
tree58fada4d7fe85094bc513b9e36004802608ab091
parent7d178454d0fb555f88d5732a76adf47390ae629d
cxl/fwctl: Fix __fortify_panic

Fix a runtime assertion in cxlctl_get_supported_features(). Fortify
complains that it is potentially overflowing the entries array per
__counted_by_le(num_entries). Quiet the false positive by initializing
@num_entries earlier.

 memcpy: detected buffer overflow: 48 byte write of buffer size 0
 WARNING: lib/string_helpers.c:1036 at __fortify_report+0x4d/0xa0, CPU#7: fwctl/1398
 RIP: 0010:__fortify_report+0x50/0xa0
 Call Trace:
  __fortify_panic+0xd/0xf
  cxlctl_get_supported_features.cold+0x23/0x35 [cxl_core]

Fixes: 4d1c09cef2c2 ("cxl: Add support for fwctl RPC command to enable CXL feature commands")
Signed-off-by: Dan Williams <djbw@kernel.org>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20260519221204.1517773-2-djbw@kernel.org
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/features.c