From: Guenter Roeck <linux@roeck-us.net>
To: sashiko-reviews@lists.linux.dev,
Abdurrahman Hussain <abdurrahman@nexthop.ai>
Cc: devicetree@vger.kernel.org, robh@kernel.org, krzk+dt@kernel.org,
linux-hwmon@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 2/2] hwmon: (pmbus/d1u74t) Add Murata D1U74T PSU driver
Date: Sat, 16 May 2026 08:19:13 -0700 [thread overview]
Message-ID: <23b62e32-8773-49f4-98d2-3c32b229650c@roeck-us.net> (raw)
In-Reply-To: <20260515033458.CFBFCC2BCB0@smtp.kernel.org>
On 5/14/26 20:34, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Low] Missing includes for <linux/module.h> and <linux/string.h>.
> - [Low] Logging raw I2C device strings without escaping.
> --
>
> commit f645f72f2f4d8cc53bec169fb4350e6231e649a4
> Author: Abdurrahman Hussain <abdurrahman@nexthop.ai>
>
> hwmon: (pmbus/d1u74t) Add Murata D1U74T PSU driver
>
> This commit adds a PMBus client driver for the Murata D1U74T power supplies.
>
> Closes: https://lore.kernel.org/oe-kbuild-all/202605122253.zInzmUeX-lkp@intel.com/
>
>> diff --git a/drivers/hwmon/pmbus/d1u74t.c b/drivers/hwmon/pmbus/d1u74t.c
>> new file mode 100644
>> index 0000000000000..286ba492e3362
>> --- /dev/null
>> +++ b/drivers/hwmon/pmbus/d1u74t.c
>> @@ -0,0 +1,86 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * Copyright 2026 Nexthop Systems.
>> + */
>> +
>> +#include <linux/i2c.h>
>> +#include <linux/of.h>
>> +#include <linux/pmbus.h>
>> +
>> +#include "pmbus.h"
>
> This isn't a bug, but should this file include <linux/module.h> and
> <linux/string.h>? It uses module-specific macros like MODULE_DEVICE_TABLE
> and MODULE_AUTHOR, as well as the strncmp function. While compilation might
> succeed due to transitive includes, it could lead to build failures or
> implicit declaration warnings on some architectures.
>
I added that; no need to resend.
> [ ... ]
>
>> +static int d1u74t_probe(struct i2c_client *client)
>> +{
>> + char buf[I2C_SMBUS_BLOCK_MAX + 2] = { 0 };
>> + struct device *dev = &client->dev;
>> + int rc;
>> +
>> + rc = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
>> + if (rc < 0)
>> + return dev_err_probe(dev, rc, "Failed to read PMBUS_MFR_ID\n");
>> +
>> + if (rc != 9 || strncmp(buf, "Murata-PS", 9)) {
>> + buf[rc] = '\0';
>> + return dev_err_probe(dev, -ENODEV,
>> + "Unsupported Manufacturer ID '%s'\n",
>> + buf);
>> + }
>> +
>> + rc = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
>> + if (rc < 0)
>> + return dev_err_probe(dev, rc,
>> + "Failed to read PMBUS_MFR_MODEL\n");
>> +
>> + if (rc < 8 || strncmp(buf, "D1U74T-W", 8)) {
>> + buf[rc] = '\0';
>> + return dev_err_probe(dev, -ENODEV, "Model '%s' not supported\n",
>> + buf);
>> + }
>
> Does this code log potentially unescaped strings directly from the device?
>
> Since the I2C bus can return garbage data or unprintable characters from a
> malfunctioning device, using the %s format specifier could result in
> corrupted log output. Would it be safer to use the %*pE specifier to safely
> escape these untrusted strings?
>
Possibly, but I'll let it go for now. Other drivers do the same. It can be
fixed in a follow-up patch if needed.
Thanks,
Guenter
next prev parent reply other threads:[~2026-05-16 15:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 3:03 [PATCH v4 0/2] hwmon: Add Murata D1U74T-W PSU driver Abdurrahman Hussain
2026-05-15 3:03 ` [PATCH v4 1/2] dt-bindings: trivial-devices: Add Murata D1U74T PSU Abdurrahman Hussain
2026-05-15 6:43 ` Krzysztof Kozlowski
2026-05-16 15:11 ` Guenter Roeck
2026-05-15 3:03 ` [PATCH v4 2/2] hwmon: (pmbus/d1u74t) Add Murata D1U74T PSU driver Abdurrahman Hussain
2026-05-15 3:34 ` sashiko-bot
2026-05-16 15:19 ` Guenter Roeck [this message]
2026-05-16 15:13 ` Guenter Roeck
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=23b62e32-8773-49f4-98d2-3c32b229650c@roeck-us.net \
--to=linux@roeck-us.net \
--cc=abdurrahman@nexthop.ai \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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