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] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 18 Sep 2016 11:56:45 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Julia Lawall <Julia.Lawall@...6.fr>
Cc:     kernel-janitors@...r.kernel.org, Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] iio: common: ssp_sensors: accel: constify iio_info
 structures

On 16/09/16 11:55, Julia Lawall wrote:
> Check for iio_info structures that are only stored in the info field of a
> iio_dev structure.  This field is declared const, so iio_info structures
> that have this property can be declared as const also.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @r disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct iio_info i@p = { ... };
> 
> @ok@
> identifier r.i;
> struct iio_dev e;
> position p;
> @@
> e.info = &i@p;
> 
> @bad@
> position p != {r.p,ok.p};
> identifier r.i;
> struct iio_info e;
> @@
> e@i@p
> 
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
>  struct iio_info i = { ... };
> // </smpl>
> 
> The result of size on this file before the change is:
>    text	      data     bss     dec         hex	  filename
>    1265        344       0    1609         649
>    drivers/iio/accel/ssp_accel_sensor.o
> 
> and after the change it is:
>    text	     data        bss	    dec	    hex	filename
>    1425	      192          0       1617     651
>    drivers/iio/accel/ssp_accel_sensor.o
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@...6.fr>
Applied to the togreg branch of iio.git.  Initially pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan
> 
> ---
>  drivers/iio/accel/ssp_accel_sensor.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/ssp_accel_sensor.c b/drivers/iio/accel/ssp_accel_sensor.c
> index 4ae05fc..31db009 100644
> --- a/drivers/iio/accel/ssp_accel_sensor.c
> +++ b/drivers/iio/accel/ssp_accel_sensor.c
> @@ -74,7 +74,7 @@ static int ssp_accel_write_raw(struct iio_dev *indio_dev,
>  	return -EINVAL;
>  }
>  
> -static struct iio_info ssp_accel_iio_info = {
> +static const struct iio_info ssp_accel_iio_info = {
>  	.read_raw = &ssp_accel_read_raw,
>  	.write_raw = &ssp_accel_write_raw,
>  };
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ