[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eab7307a-d6a2-402b-945b-674e9c5f608b@intel.com>
Date: Tue, 1 Jul 2025 18:04:04 +0530
From: "Nilawar, Badal" <badal.nilawar@...el.com>
To: Greg KH <gregkh@...uxfoundation.org>
CC: "Usyskin, Alexander" <alexander.usyskin@...el.com>,
<intel-xe@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
<linux-kernel@...r.kernel.org>, <anshuman.gupta@...el.com>,
<rodrigo.vivi@...el.com>, <daniele.ceraolospurio@...el.com>
Subject: Re: [PATCH v4 02/10] mei: late_bind: add late binding component
driver
On 01-07-2025 15:15, Greg KH wrote:
> On Tue, Jul 01, 2025 at 02:02:15PM +0530, Nilawar, Badal wrote:
>> On 28-06-2025 17:48, Greg KH wrote:
>>>> + * @payload_size: size of the payload data in bytes
>>>> + * @payload: data to be sent to the firmware
>>>> + */
>>>> +struct csc_heci_late_bind_req {
>>>> + struct mkhi_msg_hdr header;
>>>> + u32 type;
>>>> + u32 flags;
>>> What is the endian of these fields? And as this crosses the
>>> kernel/hardware boundry, shouldn't these be __u32?
>> endian of these fields is little endian, all the headers are little endian.
>> I will add comment at top.
> No, use the proper types if this is little endian. Don't rely on a
> comment to catch things when it goes wrong.
>
>> On __u32 I doubt we need to do it as csc send copy it to internal buffer.
> If this crosses the kernel boundry, it needs to use the proper type.
Understood. I will proceed with using __le32 in this context, provided
that Sasha agrees.
>
>>>> +{
>>>> + struct mei_cl_device *cldev;
>>>> + struct csc_heci_late_bind_req *req = NULL;
>>>> + struct csc_heci_late_bind_rsp rsp;
>>>> + size_t req_size;
>>>> + ssize_t ret;
>>>> +
>>>> + if (!dev || !payload || !payload_size)
>>>> + return -EINVAL;
>>> How can any of these ever happen as you control the callers of this
>>> function?
>> I will add WARN here.
> So you will end up crashing the machine and getting a CVE assigned for
> it?
>
> Please no. If it can't happen, then don't check for it. If it can
> happen, great, handle it properly. Don't just give up and cause a
> system to reboot, that's a horrible way to write kernel code.
Fine, will drop the idea of WARN here.
Thanks,
Badal
>
> thanks,
>
> greg k-h
Powered by blists - more mailing lists