lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <NRoZvEd3G9hUveVmurvooyzuQ0LfrghfASmcQHggvJhrPCiqvunmHFg3iyhi49ufJ0zKOpzwkUc4btlf1bkR_-CTcCM2hJcifqPdqbxinXQ=@ranostay.sg>
Date: Thu, 04 Dec 2025 11:03:44 +0000
From: Matt Ranostay <matt@...ostay.sg>
To: Haotian Zhang <vulab@...as.ac.cn>
Cc: sre@...nel.org, pali@...nel.org, linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] power: supply: bq27xxx: fix wrong errno when bus ops are unsupported

Seems reasonable enough..
Only possible concern is breaking ABI if some application is wrongly expecting -EPERM for an error condition, but seems unlikely enough to not correct this.

Reviewed-by: Matt Ranostay <matt@...ostay.sg>

Sent with Proton Mail secure email.

On Thursday, December 4th, 2025 at 16:35, Haotian Zhang <vulab@...as.ac.cn> wrote:

> bq27xxx_write(), bq27xxx_read_block(), and bq27xxx_write_block()
> return -EPERM when the bus callback pointer is NULL. A NULL callback
> indicates the operation is not supported by the bus/driver,
> not that permission is denied.
> 
> Return -EOPNOTSUPP instead of -EPERM when di->bus.write/
> 
> read_bulk/write_bulk is NULL.
> 
> Fixes: 14073f6614f6 ("power: supply: bq27xxx: Add bulk transfer bus methods")
> Signed-off-by: Haotian Zhang vulab@...as.ac.cn
> 
> ---
> drivers/power/supply/bq27xxx_battery.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
> index ad2d9ecf32a5..1d7aa240126a 100644
> --- a/drivers/power/supply/bq27xxx_battery.c
> +++ b/drivers/power/supply/bq27xxx_battery.c
> @@ -1172,7 +1172,7 @@ static inline int bq27xxx_write(struct bq27xxx_device_info *di, int reg_index,
> return -EINVAL;
> 
> if (!di->bus.write)
> 
> - return -EPERM;
> + return -EOPNOTSUPP;
> 
> ret = di->bus.write(di, di->regs[reg_index], value, single);
> 
> if (ret < 0)
> @@ -1191,7 +1191,7 @@ static inline int bq27xxx_read_block(struct bq27xxx_device_info *di, int reg_ind
> return -EINVAL;
> 
> if (!di->bus.read_bulk)
> 
> - return -EPERM;
> + return -EOPNOTSUPP;
> 
> ret = di->bus.read_bulk(di, di->regs[reg_index], data, len);
> 
> if (ret < 0)
> @@ -1210,7 +1210,7 @@ static inline int bq27xxx_write_block(struct bq27xxx_device_info *di, int reg_in
> return -EINVAL;
> 
> if (!di->bus.write_bulk)
> 
> - return -EPERM;
> + return -EOPNOTSUPP;
> 
> ret = di->bus.write_bulk(di, di->regs[reg_index], data, len);
> 
> if (ret < 0)
> --
> 2.50.1.windows.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ