All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Nilawar, Badal" <badal.nilawar@intel.com>
Cc: "Usyskin, Alexander" <alexander.usyskin@intel.com>,
	intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, anshuman.gupta@intel.com,
	rodrigo.vivi@intel.com, daniele.ceraolospurio@intel.com
Subject: Re: [PATCH v4 02/10] mei: late_bind: add late binding component driver
Date: Tue, 1 Jul 2025 11:45:28 +0200	[thread overview]
Message-ID: <2025070140-dad-jaywalker-0774@gregkh> (raw)
In-Reply-To: <205cc43a-4254-4d27-9b4f-139006e871e4@intel.com>

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.

> > > +{
> > > +	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.

thanks,

greg k-h

  reply	other threads:[~2025-07-01  9:45 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25 17:00 [PATCH v4 00/10] Introducing firmware late binding Badal Nilawar
2025-06-25 17:00 ` [PATCH v4 01/10] mei: bus: add mei_cldev_mtu interface Badal Nilawar
2025-06-25 17:00 ` [PATCH v4 02/10] mei: late_bind: add late binding component driver Badal Nilawar
2025-06-26  3:50   ` Gupta, Anshuman
2025-06-27 14:06     ` Nilawar, Badal
2025-06-28 12:18   ` Greg KH
2025-07-01  8:32     ` Nilawar, Badal
2025-07-01  9:45       ` Greg KH [this message]
2025-07-01 12:34         ` Nilawar, Badal
2025-07-01 16:41           ` Nilawar, Badal
2025-07-01 17:34             ` Rodrigo Vivi
2025-07-02  4:12               ` Gupta, Anshuman
2025-07-02  6:24               ` Usyskin, Alexander
2025-07-01 10:05     ` Usyskin, Alexander
2025-06-28 12:19   ` Greg KH
2025-07-01  8:07     ` Nilawar, Badal
2025-07-01  8:17       ` Greg KH
2025-07-01  8:22         ` Nilawar, Badal
2025-07-01  8:32           ` Usyskin, Alexander
2025-06-25 17:00 ` [PATCH v4 03/10] drm/xe/xe_late_bind_fw: Introducing xe_late_bind_fw Badal Nilawar
2025-06-27 21:04   ` Rodrigo Vivi
2025-06-30 13:49     ` Nilawar, Badal
2025-06-25 17:00 ` [PATCH v4 04/10] drm/xe/xe_late_bind_fw: Initialize late binding firmware Badal Nilawar
2025-06-26 21:06   ` Daniele Ceraolo Spurio
2025-06-27 12:48     ` Nilawar, Badal
2025-06-25 17:00 ` [PATCH v4 05/10] drm/xe/xe_late_bind_fw: Load " Badal Nilawar
2025-06-26 17:24   ` Rodrigo Vivi
2025-06-26 21:27     ` Daniele Ceraolo Spurio
2025-06-26 21:49       ` Rodrigo Vivi
2025-06-26 22:38         ` Daniele Ceraolo Spurio
2025-06-26 22:49           ` Rodrigo Vivi
2025-06-25 17:00 ` [PATCH v4 06/10] drm/xe/xe_late_bind_fw: Reload late binding fw in rpm resume Badal Nilawar
2025-06-25 17:00 ` [PATCH v4 07/10] drm/xe/xe_late_bind_fw: Reload late binding fw during system resume Badal Nilawar
2025-06-27  7:53   ` Nilawar, Badal
2025-06-25 17:00 ` [PATCH v4 08/10] drm/xe/xe_late_bind_fw: Introduce debug fs node to disable late binding Badal Nilawar
2025-06-25 17:00 ` [PATCH v4 09/10] drm/xe/xe_late_bind_fw: Extract and print version info Badal Nilawar
2025-06-26 21:32   ` Daniele Ceraolo Spurio
2025-06-25 17:00 ` [PATCH v4 10/10] drm/xe/xe_late_bind_fw: Select INTEL_MEI_LATE_BIND for CI Badal Nilawar
2025-06-25 17:59 ` ✗ CI.checkpatch: warning for Introducing firmware late binding Patchwork
2025-06-25 18:00 ` ✓ CI.KUnit: success " Patchwork
2025-06-25 18:15 ` ✗ CI.checksparse: warning " Patchwork
2025-06-25 18:52 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-06-26 20:49 ` ✗ Xe.CI.Full: " Patchwork

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=2025070140-dad-jaywalker-0774@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.usyskin@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigo.vivi@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.