From: Arnd Bergmann <arnd@kernel.org>
To: "Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Nathan Chancellor" <nathan@kernel.org>,
"Tao Zhou" <tao.zhou1@amd.com>,
"Hawking Zhang" <Hawking.Zhang@amd.com>,
"YiPeng Chai" <YiPeng.Chai@amd.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Gangliang Xie <ganglxie@amd.com>, Kees Cook <kees@kernel.org>,
Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH] drm/amd/ras: work around write overflow attribute warning
Date: Wed, 18 Mar 2026 11:50:36 +0100 [thread overview]
Message-ID: <20260318105050.1947902-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
clang-22 warns about possibly copying beyind the end of an array:
In file included from drivers/gpu/drm/amd/amdgpu/../ras/rascore/ras_umc.c:24:
In file included from drivers/gpu/drm/amd/amdgpu/../ras/rascore/ras.h:27:
In file included from drivers/gpu/drm/amd/amdgpu/../ras/ras_mgr/ras_sys.h:29:
In file included from include/linux/string.h:386:
include/linux/fortify-string.h:569:4: error: call to '__write_overflow_field' declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
569 | __write_overflow_field(p_size_field, size);
| ^
As far as I can tell, this is a false-postive warning, but there is
an easy workaround, by using a direct struct assignment in place of
the memcpy.
Fixes: 7a3f9c0992c4 ("drm/amd/ras: Add umc common ras functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/amd/ras/rascore/ras_umc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/ras/rascore/ras_umc.c b/drivers/gpu/drm/amd/ras/rascore/ras_umc.c
index 23118f41eb96..fb426386b384 100644
--- a/drivers/gpu/drm/amd/ras/rascore/ras_umc.c
+++ b/drivers/gpu/drm/amd/ras/rascore/ras_umc.c
@@ -290,7 +290,7 @@ static int ras_umc_get_new_records(struct ras_core_context *ras_core,
if (!entries[i])
continue;
- memcpy(&records[i], entries[i], sizeof(struct eeprom_umc_record));
+ records[i] = *entries[i];
count++;
radix_tree_tag_clear(&ras_umc->root,
entries[i]->cur_nps_retired_row_pfn, UMC_ECC_NEW_DETECTED_TAG);
--
2.39.5
next reply other threads:[~2026-03-18 10:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 10:50 Arnd Bergmann [this message]
2026-03-18 16:23 ` [PATCH] drm/amd/ras: work around write overflow attribute warning Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260318105050.1947902-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=Hawking.Zhang@amd.com \
--cc=YiPeng.Chai@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=arnd@arndb.de \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ganglxie@amd.com \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=simona@ffwll.ch \
--cc=srinivasan.shanmugam@amd.com \
--cc=tao.zhou1@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox