linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: "Christian König" <christian.koenig@amd.com>,
	"Lijo Lazar" <lijo.lazar@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Hawking Zhang <Hawking.Zhang@amd.com>,
	Feifei Xu <Feifei.Xu@amd.com>, Likun Gao <Likun.Gao@amd.com>,
	Jiawei Gu <Jiawei.Gu@amd.com>, Evan Quan <evan.quan@amd.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Alex Deucher <alexander.deucher@amd.com>,
	Luben Tuikov <luben.tuikov@amd.com>,
	Andrey Grodzovsky <andrey.grodzovsky@amd.com>,
	Dennis Li <Dennis.Li@amd.com>,
	Sathishkumar S <sathishkumar.sundararaju@amd.com>,
	Jonathan Kim <jonathan.kim@amd.com>,
	Kevin Wang <kevin1.wang@amd.com>,
	David M Nieto <David.Nieto@amd.com>,
	Kenneth Feng <kenneth.feng@amd.com>,
	Lee Jones <lee.jones@linaro.org>,
	John Clements <John.Clements@amd.com>,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] drm/amd/pm: And destination bounds checking to struct copy
Date: Mon, 23 Aug 2021 07:23:14 -0700	[thread overview]
Message-ID: <FB2A077F-78CB-4D84-A8F2-C63C57923496@chromium.org> (raw)
In-Reply-To: <4922d89d-1293-7b32-d684-c731c246e6c1@amd.com>



On August 22, 2021 11:28:54 PM PDT, "Christian König" <christian.koenig@amd.com> wrote:
>
>
>Am 19.08.21 um 22:14 schrieb Kees Cook:
>> [...]
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index 96e895d6be35..4605934a4fb7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -1446,4 +1446,29 @@ static inline int amdgpu_in_reset(struct amdgpu_device *adev)
>>   {
>>   	return atomic_read(&adev->in_gpu_reset);
>>   }
>> +
>> +/**
>> + * memcpy_trailing - Copy the end of one structure into the middle of another
>> + *
>> + * @dst: Pointer to destination struct
>> + * @first_dst_member: The member name in @dst where the overwrite begins
>> + * @last_dst_member: The member name in @dst where the overwrite ends after
>> + * @src: Pointer to the source struct
>> + * @first_src_member: The member name in @src where the copy begins
>> + *
>> + */
>> +#define memcpy_trailing(dst, first_dst_member, last_dst_member,		   \
>> +		        src, first_src_member)				   \
>
>Please don't add a function like this into amdgpu.h, especially when it 
>is only used by the SMU code.

Sure, I'm happy to move it. It wasn't clear to me which headers were considered "immutable". Which header should I put this in?

>And please give it an amdgpu_ prefix so that we are not confusing it 
>with a core function.

Sure, I will include that.

>Apart from that looks good to me.

Thanks!

-Kees

  reply	other threads:[~2021-08-23 14:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 20:14 [PATCH] drm/amd/pm: And destination bounds checking to struct copy Kees Cook
2021-08-20 15:27 ` Alex Deucher
2021-08-23  5:36 ` Lazar, Lijo
2021-08-23  6:28 ` Christian König
2021-08-23 14:23   ` Kees Cook [this message]
2021-08-23 19:01     ` Christian König
2021-08-23 19:13       ` Deucher, Alexander

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=FB2A077F-78CB-4D84-A8F2-C63C57923496@chromium.org \
    --to=keescook@chromium.org \
    --cc=David.Nieto@amd.com \
    --cc=Dennis.Li@amd.com \
    --cc=Feifei.Xu@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Jiawei.Gu@amd.com \
    --cc=John.Clements@amd.com \
    --cc=Likun.Gao@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrey.grodzovsky@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=evan.quan@amd.com \
    --cc=jonathan.kim@amd.com \
    --cc=kenneth.feng@amd.com \
    --cc=kevin1.wang@amd.com \
    --cc=lee.jones@linaro.org \
    --cc=lijo.lazar@amd.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luben.tuikov@amd.com \
    --cc=sathishkumar.sundararaju@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;
as well as URLs for NNTP newsgroup(s).