File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
drivers/iio/imu/inv_icm42600 Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -902,7 +902,8 @@ int inv_icm42600_accel_parse_fifo(struct iio_dev *indio_dev)
902
902
const int8_t * temp ;
903
903
unsigned int odr ;
904
904
int64_t ts_val ;
905
- struct inv_icm42600_accel_buffer buffer ;
905
+ /* buffer is copied to userspace, zeroing it to avoid any data leak */
906
+ struct inv_icm42600_accel_buffer buffer = { };
906
907
907
908
/* parse all fifo packets */
908
909
for (i = 0 , no = 0 ; i < st -> fifo .count ; i += size , ++ no ) {
@@ -921,8 +922,6 @@ int inv_icm42600_accel_parse_fifo(struct iio_dev *indio_dev)
921
922
inv_sensors_timestamp_apply_odr (ts , st -> fifo .period ,
922
923
st -> fifo .nb .total , no );
923
924
924
- /* buffer is copied to userspace, zeroing it to avoid any data leak */
925
- memset (& buffer , 0 , sizeof (buffer ));
926
925
memcpy (& buffer .accel , accel , sizeof (buffer .accel ));
927
926
/* convert 8 bits FIFO temperature in high resolution format */
928
927
buffer .temp = temp ? (* temp * 64 ) : 0 ;
Original file line number Diff line number Diff line change @@ -806,7 +806,8 @@ int inv_icm42600_gyro_parse_fifo(struct iio_dev *indio_dev)
806
806
const int8_t * temp ;
807
807
unsigned int odr ;
808
808
int64_t ts_val ;
809
- struct inv_icm42600_gyro_buffer buffer ;
809
+ /* buffer is copied to userspace, zeroing it to avoid any data leak */
810
+ struct inv_icm42600_gyro_buffer buffer = { };
810
811
811
812
/* parse all fifo packets */
812
813
for (i = 0 , no = 0 ; i < st -> fifo .count ; i += size , ++ no ) {
@@ -825,8 +826,6 @@ int inv_icm42600_gyro_parse_fifo(struct iio_dev *indio_dev)
825
826
inv_sensors_timestamp_apply_odr (ts , st -> fifo .period ,
826
827
st -> fifo .nb .total , no );
827
828
828
- /* buffer is copied to userspace, zeroing it to avoid any data leak */
829
- memset (& buffer , 0 , sizeof (buffer ));
830
829
memcpy (& buffer .gyro , gyro , sizeof (buffer .gyro ));
831
830
/* convert 8 bits FIFO temperature in high resolution format */
832
831
buffer .temp = temp ? (* temp * 64 ) : 0 ;
You can’t perform that action at this time.
0 commit comments