linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] misc: remove boundary checks from bin attr users
@ 2015-07-26 21:18 Vladimir Zapolskiy
  2015-07-26 21:18 ` [PATCH 1/8] misc: cxl: clean up afu_read_config() Vladimir Zapolskiy
  2015-08-07 16:10 ` [PATCH 0/8] misc: remove boundary checks from bin attr users Wolfram Sang
  0 siblings, 2 replies; 9+ messages in thread
From: Vladimir Zapolskiy @ 2015-07-26 21:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Wolfram Sang, Maxime Ripard, Jean Delvare,
	Ian Munsie, Michael Neuling
  Cc: Arnd Bergmann, linuxppc-dev, linux-arm-kernel, linux-i2c,
	linux-kernel

This change removes a number of redundant checks on bin attribute
client's side, the same checks are done by sysfs_kf_bin_read() or
sysfs_kf_bin_write() caller from fs/sysfs/file.c.

Note, drivers/misc/pch_phub.c and drivers/misc/c2port/core.c may be
updated in a similar way, however this task is not done due to more
complicated read()/write() callbacks.

No functional change, hopefully.

Vladimir Zapolskiy (8):
  misc: cxl: clean up afu_read_config()
  misc: ds1682: clean up ds1682_eeprom_read() and ds1682_eeprom_write()
  misc: eeprom: 93xx46: clean up eeprom_93xx46_bin_read/write
  misc: eeprom: clean up eeprom_read()
  misc: eeprom: max6875: clean up max6875_read()
  misc: eeprom: at24: clean up at24_bin_write()
  misc: eeprom: at25: move eeprom boundary checks to mem_read/mem_write
  misc: eeprom: sunxi_sid: clean up sid_read()

 drivers/misc/cxl/sysfs.c            |  7 +------
 drivers/misc/ds1682.c               | 12 ------------
 drivers/misc/eeprom/at24.c          |  3 ---
 drivers/misc/eeprom/at25.c          | 28 ++++++++++++++--------------
 drivers/misc/eeprom/eeprom.c        |  5 -----
 drivers/misc/eeprom/eeprom_93xx46.c | 14 --------------
 drivers/misc/eeprom/max6875.c       |  6 ------
 drivers/misc/eeprom/sunxi_sid.c     |  5 -----
 8 files changed, 15 insertions(+), 65 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/8] misc: cxl: clean up afu_read_config()
  2015-07-26 21:18 [PATCH 0/8] misc: remove boundary checks from bin attr users Vladimir Zapolskiy
@ 2015-07-26 21:18 ` Vladimir Zapolskiy
  2015-07-26 23:06   ` Daniel Axtens
  2015-08-05  7:48   ` Michael Neuling
  2015-08-07 16:10 ` [PATCH 0/8] misc: remove boundary checks from bin attr users Wolfram Sang
  1 sibling, 2 replies; 9+ messages in thread
From: Vladimir Zapolskiy @ 2015-07-26 21:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, linuxppc-dev, Ian Munsie, Michael Neuling

The sanity checks for overflow are not needed, because this is done on
caller side in fs/sysfs/file.c

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Ian Munsie <imunsie@au1.ibm.com>
Cc: Michael Neuling <mikey@neuling.org>
---
 drivers/misc/cxl/sysfs.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
index 31f38bc..87cd747 100644
--- a/drivers/misc/cxl/sysfs.c
+++ b/drivers/misc/cxl/sysfs.c
@@ -443,12 +443,7 @@ static ssize_t afu_read_config(struct file *filp, struct kobject *kobj,
 	struct afu_config_record *cr = to_cr(kobj);
 	struct cxl_afu *afu = to_cxl_afu(container_of(kobj->parent, struct device, kobj));
 
-	u64 i, j, val, size = afu->crs_len;
-
-	if (off > size)
-		return 0;
-	if (off + count > size)
-		count = size - off;
+	u64 i, j, val;
 
 	for (i = 0; i < count;) {
 		val = cxl_afu_cr_read64(afu, cr->cr, off & ~0x7);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/8] misc: cxl: clean up afu_read_config()
  2015-07-26 21:18 ` [PATCH 1/8] misc: cxl: clean up afu_read_config() Vladimir Zapolskiy
@ 2015-07-26 23:06   ` Daniel Axtens
  2015-08-05  7:48   ` Michael Neuling
  1 sibling, 0 replies; 9+ messages in thread
From: Daniel Axtens @ 2015-07-26 23:06 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Greg Kroah-Hartman, Michael Neuling, linuxppc-dev, linux-kernel,
	Ian Munsie

[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]

Hi,

Reviewed-by: Daniel Axtens <dja@axtens.net>

FWIW, Ian is on leave for 2 weeks and Mikey for 1 week. However, as one
of the other CXL developers I'm very happy for this patch to go in.

Regards,
Daniel

On Mon, 2015-07-27 at 00:18 +0300, Vladimir Zapolskiy wrote:
> The sanity checks for overflow are not needed, because this is done on
> caller side in fs/sysfs/file.c
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: Ian Munsie <imunsie@au1.ibm.com>
> Cc: Michael Neuling <mikey@neuling.org>
> ---
>  drivers/misc/cxl/sysfs.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
> index 31f38bc..87cd747 100644
> --- a/drivers/misc/cxl/sysfs.c
> +++ b/drivers/misc/cxl/sysfs.c
> @@ -443,12 +443,7 @@ static ssize_t afu_read_config(struct file *filp, struct kobject *kobj,
>  	struct afu_config_record *cr = to_cr(kobj);
>  	struct cxl_afu *afu = to_cxl_afu(container_of(kobj->parent, struct device, kobj));
>  
> -	u64 i, j, val, size = afu->crs_len;
> -
> -	if (off > size)
> -		return 0;
> -	if (off + count > size)
> -		count = size - off;
> +	u64 i, j, val;
>  
>  	for (i = 0; i < count;) {
>  		val = cxl_afu_cr_read64(afu, cr->cr, off & ~0x7);


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 860 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/8] misc: cxl: clean up afu_read_config()
  2015-07-26 21:18 ` [PATCH 1/8] misc: cxl: clean up afu_read_config() Vladimir Zapolskiy
  2015-07-26 23:06   ` Daniel Axtens
@ 2015-08-05  7:48   ` Michael Neuling
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Neuling @ 2015-08-05  7:48 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Greg Kroah-Hartman, linux-kernel, linuxppc-dev, Ian Munsie,
	Michael Ellerman

On Mon, 2015-07-27 at 00:18 +0300, Vladimir Zapolskiy wrote:
> The sanity checks for overflow are not needed, because this is done on
> caller side in fs/sysfs/file.c
>=20
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: Ian Munsie <imunsie@au1.ibm.com>
> Cc: Michael Neuling <mikey@neuling.org>

Acked-by: Michael Neuling <mikey@neuling.org>

> ---
>  drivers/misc/cxl/sysfs.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>=20
> diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
> index 31f38bc..87cd747 100644
> --- a/drivers/misc/cxl/sysfs.c
> +++ b/drivers/misc/cxl/sysfs.c
> @@ -443,12 +443,7 @@ static ssize_t afu_read_config(struct file *filp, st=
ruct kobject *kobj,
>  	struct afu_config_record *cr =3D to_cr(kobj);
>  	struct cxl_afu *afu =3D to_cxl_afu(container_of(kobj->parent, struct de=
vice, kobj));
> =20
> -	u64 i, j, val, size =3D afu->crs_len;
> -
> -	if (off > size)
> -		return 0;
> -	if (off + count > size)
> -		count =3D size - off;
> +	u64 i, j, val;
> =20
>  	for (i =3D 0; i < count;) {
>  		val =3D cxl_afu_cr_read64(afu, cr->cr, off & ~0x7);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/8] misc: remove boundary checks from bin attr users
  2015-07-26 21:18 [PATCH 0/8] misc: remove boundary checks from bin attr users Vladimir Zapolskiy
  2015-07-26 21:18 ` [PATCH 1/8] misc: cxl: clean up afu_read_config() Vladimir Zapolskiy
@ 2015-08-07 16:10 ` Wolfram Sang
  2015-08-07 16:15   ` Vladimir Zapolskiy
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2015-08-07 16:10 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Greg Kroah-Hartman, Maxime Ripard, Jean Delvare, Ian Munsie,
	Michael Neuling, Arnd Bergmann, linuxppc-dev, linux-arm-kernel,
	linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

Vladimir,

On Mon, Jul 27, 2015 at 12:18:22AM +0300, Vladimir Zapolskiy wrote:
> This change removes a number of redundant checks on bin attribute
> client's side, the same checks are done by sysfs_kf_bin_read() or
> sysfs_kf_bin_write() caller from fs/sysfs/file.c.
> 
> Note, drivers/misc/pch_phub.c and drivers/misc/c2port/core.c may be
> updated in a similar way, however this task is not done due to more
> complicated read()/write() callbacks.

Can you resend the patches which touch i2c drivers with me on cc? I'd
like to take care of them.

Thanks,

   Wolfram


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/8] misc: remove boundary checks from bin attr users
  2015-08-07 16:10 ` [PATCH 0/8] misc: remove boundary checks from bin attr users Wolfram Sang
@ 2015-08-07 16:15   ` Vladimir Zapolskiy
  2015-08-07 22:34     ` Wolfram Sang
  0 siblings, 1 reply; 9+ messages in thread
From: Vladimir Zapolskiy @ 2015-08-07 16:15 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Greg Kroah-Hartman, Maxime Ripard, Jean Delvare, Ian Munsie,
	Michael Neuling, Arnd Bergmann, linuxppc-dev, linux-arm-kernel,
	linux-i2c, linux-kernel

Hi Wolfram,

On 07.08.2015 19:10, Wolfram Sang wrote:
> Vladimir,
> 
> On Mon, Jul 27, 2015 at 12:18:22AM +0300, Vladimir Zapolskiy wrote:
>> This change removes a number of redundant checks on bin attribute
>> client's side, the same checks are done by sysfs_kf_bin_read() or
>> sysfs_kf_bin_write() caller from fs/sysfs/file.c.
>>
>> Note, drivers/misc/pch_phub.c and drivers/misc/c2port/core.c may be
>> updated in a similar way, however this task is not done due to more
>> complicated read()/write() callbacks.
> 
> Can you resend the patches which touch i2c drivers with me on cc? I'd
> like to take care of them.

if we're talking about this particular series, you should have them in
your mailbox, since you have them applied in wsa/i2c/for-next:

commit d12c0aaf3780c5b26b4ea9e795252381f586c063
Author: Vladimir Zapolskiy <vz@mleia.com>
Date:   Mon Jul 27 00:18:51 2015 +0300

    misc: eeprom: at24: clean up at24_bin_write()

    The change removes redundant sysfs binary file boundary check, since
    this task is already done on caller side in fs/sysfs/file.c

    Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

commit 1f023297f7f77d434ecc221018d2e181eac0ae36
Author: Vladimir Zapolskiy <vz@mleia.com>
Date:   Mon Jul 27 00:16:31 2015 +0300

    i2c: slave eeprom: clean up sysfs bin attribute read()/write()

    The change removes redundant sysfs binary file boundary checks,
    since this task is already done on caller side in fs/sysfs/file.c

    Note, on file size overflow read() now returns 0, and this is a
    correct and expected EOF notification according to POSIX.

    Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


Do you want me to send them to you again anyway?

--
With best wishes,
Vladimir

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/8] misc: remove boundary checks from bin attr users
  2015-08-07 16:15   ` Vladimir Zapolskiy
@ 2015-08-07 22:34     ` Wolfram Sang
  2015-08-08 12:51       ` Vladimir Zapolskiy
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2015-08-07 22:34 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Greg Kroah-Hartman, Maxime Ripard, Jean Delvare, Ian Munsie,
	Michael Neuling, Arnd Bergmann, linuxppc-dev, linux-arm-kernel,
	linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]


> if we're talking about this particular series, you should have them in
> your mailbox, since you have them applied in wsa/i2c/for-next:

Those are already in linus tree. I mean all drivers which use struct
i2c_driver. Or do you prefer they go via Greg? I am fine with both.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/8] misc: remove boundary checks from bin attr users
  2015-08-07 22:34     ` Wolfram Sang
@ 2015-08-08 12:51       ` Vladimir Zapolskiy
  2015-08-08 16:49         ` Wolfram Sang
  0 siblings, 1 reply; 9+ messages in thread
From: Vladimir Zapolskiy @ 2015-08-08 12:51 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Greg Kroah-Hartman, Maxime Ripard, Jean Delvare, Ian Munsie,
	Michael Neuling, Arnd Bergmann, linuxppc-dev, linux-arm-kernel,
	linux-i2c, linux-kernel

Hi Wolfram,

On 08.08.2015 01:34, Wolfram Sang wrote:
> 
>> if we're talking about this particular series, you should have them in
>> your mailbox, since you have them applied in wsa/i2c/for-next:
> 
> Those are already in linus tree. I mean all drivers which use struct
> i2c_driver. Or do you prefer they go via Greg? I am fine with both.
> 

I think you may find most of the changes applied by Greg into
misc/char-misc-next branch.

The only change from the series, which is not found in
misc/char-misc-next or i2c/for-next is related to at25 driver (IC is
sitting on SPI):

  https://lkml.org/lkml/2015/7/26/101

Change 8/8 for sunxi is outdated due to accepted NVMEM framework.

With best wishes,
Vladimir

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/8] misc: remove boundary checks from bin attr users
  2015-08-08 12:51       ` Vladimir Zapolskiy
@ 2015-08-08 16:49         ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2015-08-08 16:49 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Greg Kroah-Hartman, Maxime Ripard, Jean Delvare, Ian Munsie,
	Michael Neuling, Arnd Bergmann, linuxppc-dev, linux-arm-kernel,
	linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

On Sat, Aug 08, 2015 at 03:51:54PM +0300, Vladimir Zapolskiy wrote:
> Hi Wolfram,
> 
> On 08.08.2015 01:34, Wolfram Sang wrote:
> > 
> >> if we're talking about this particular series, you should have them in
> >> your mailbox, since you have them applied in wsa/i2c/for-next:
> > 
> > Those are already in linus tree. I mean all drivers which use struct
> > i2c_driver. Or do you prefer they go via Greg? I am fine with both.
> > 
> 
> I think you may find most of the changes applied by Greg into
> misc/char-misc-next branch.

Great, thanks for the heads up!


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-08-08 16:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-26 21:18 [PATCH 0/8] misc: remove boundary checks from bin attr users Vladimir Zapolskiy
2015-07-26 21:18 ` [PATCH 1/8] misc: cxl: clean up afu_read_config() Vladimir Zapolskiy
2015-07-26 23:06   ` Daniel Axtens
2015-08-05  7:48   ` Michael Neuling
2015-08-07 16:10 ` [PATCH 0/8] misc: remove boundary checks from bin attr users Wolfram Sang
2015-08-07 16:15   ` Vladimir Zapolskiy
2015-08-07 22:34     ` Wolfram Sang
2015-08-08 12:51       ` Vladimir Zapolskiy
2015-08-08 16:49         ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).