Skip to content

Commit cd28a9b

Browse files
committed
Zero memory before passing it to FFI function
1 parent 9c75fa2 commit cd28a9b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl Chip {
211211
/// Open the GPIO Chip at the provided path (e.g. `/dev/gpiochip<N>`)
212212
pub fn new<P: AsRef<Path>>(path: P) -> Result<Chip> {
213213
let f = File::open(path.as_ref())?;
214-
let mut info: ffi::gpiochip_info = unsafe { mem::MaybeUninit::uninit().assume_init() };
214+
let mut info: ffi::gpiochip_info = unsafe { mem::zeroed() };
215215
ffi::gpio_get_chipinfo_ioctl(f.as_raw_fd(), &mut info)?;
216216

217217
Ok(Chip {

0 commit comments

Comments
 (0)