mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Maximilian Luz <luzmaximilian@gmail.com>
Cc: Jean Delvare <jdelvare@suse.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Ivor Wanders <ivor@iwanders.net>,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v4] hwmon: Add thermal sensor driver for Surface Aggregator Module
Date: Tue, 13 Aug 2024 11:19:09 -0700	[thread overview]
Message-ID: <9c54fd98-7e59-4cfd-b005-64af558541b5@roeck-us.net> (raw)
In-Reply-To: <20240811001503.753728-1-luzmaximilian@gmail.com>

On Sun, Aug 11, 2024 at 02:14:41AM +0200, Maximilian Luz wrote:
> Some of the newer Microsoft Surface devices (such as the Surface Book
> 3 and Pro 9) have thermal sensors connected via the Surface Aggregator
> Module (the embedded controller on those devices). Add a basic driver
> to read out the temperature values of those sensors.
> 
> The EC can have up to 16 thermal sensors connected via a single
> sub-device, each providing temperature readings and a label string.
> 
> Link: https://github.com/linux-surface/surface-aggregator-module/issues/59
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Co-developed-by: Ivor Wanders <ivor@iwanders.net>
> Signed-off-by: Ivor Wanders <ivor@iwanders.net>
> Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>

Applied. One comment below, though.

> ---
> +
> +	/*
> +	 * This should not fail unless the name in the returned struct is not
> +	 * null-terminated or someone changed something in the struct
> +	 * definitions above, since our buffer and struct have the same
> +	 * capacity by design. So if this fails, log an error message. Since
> +	 * the more likely cause is that the returned string isn't
> +	 * null-terminated, we might have received garbage (as opposed to just
> +	 * an incomplete string), so also fail the function.
> +	 */
> +	status = strscpy(buf, name_rsp.name, buf_len);
> +	if (status < 0) {
> +		dev_err(&sdev->dev, "received non-null-terminated sensor name string\n");
> +		return status;
> +	}

If that ever happens, it will likely be permanent and clog the kernel log.
Normally I'd ask you to make it _once, but I am kind of tired right now of
having to explain to people that clogging the kernel log isn't really a
good idea - even more so if the message doesn't provide any real value.

Guenter

  reply	other threads:[~2024-08-13 18:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11  0:14 Maximilian Luz
2024-08-13 18:19 ` Guenter Roeck [this message]
2024-08-13 18:42   ` Maximilian Luz

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=9c54fd98-7e59-4cfd-b005-64af558541b5@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=hdegoede@redhat.com \
    --cc=ivor@iwanders.net \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luzmaximilian@gmail.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

all inboxes | Powered by JetHome®