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)
902902 const int8_t * temp ;
903903 unsigned int odr ;
904904 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 = { };
906907
907908 /* parse all fifo packets */
908909 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)
921922 inv_sensors_timestamp_apply_odr (ts , st -> fifo .period ,
922923 st -> fifo .nb .total , no );
923924
924- /* buffer is copied to userspace, zeroing it to avoid any data leak */
925- memset (& buffer , 0 , sizeof (buffer ));
926925 memcpy (& buffer .accel , accel , sizeof (buffer .accel ));
927926 /* convert 8 bits FIFO temperature in high resolution format */
928927 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)
806806 const int8_t * temp ;
807807 unsigned int odr ;
808808 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 = { };
810811
811812 /* parse all fifo packets */
812813 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)
825826 inv_sensors_timestamp_apply_odr (ts , st -> fifo .period ,
826827 st -> fifo .nb .total , no );
827828
828- /* buffer is copied to userspace, zeroing it to avoid any data leak */
829- memset (& buffer , 0 , sizeof (buffer ));
830829 memcpy (& buffer .gyro , gyro , sizeof (buffer .gyro ));
831830 /* convert 8 bits FIFO temperature in high resolution format */
832831 buffer .temp = temp ? (* temp * 64 ) : 0 ;
You can’t perform that action at this time.
0 commit comments