From a3199d58dbdca9d0a8cd3df1b740024f49333a65 Mon Sep 17 00:00:00 2001 From: VasiliyS Date: Wed, 13 Mar 2024 18:00:22 +0100 Subject: [PATCH] rust/pv_core: Fix UvDeviceInfo::get() method. `ATTESTATION_NR` flag was not set properly in case the device didn't support `Info` IOCTL call. Closes: https://github.com/ibm-s390-linux/s390-tools/pull/163 Signed-off-by: Vasiliy Suvorov Reviewed-by: Steffen Eiden Signed-off-by: Steffen Eiden --- rust/pv_core/src/uvdevice/info.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rust/pv_core/src/uvdevice/info.rs b/rust/pv_core/src/uvdevice/info.rs index fd2057c0..53175fe5 100644 --- a/rust/pv_core/src/uvdevice/info.rs +++ b/rust/pv_core/src/uvdevice/info.rs @@ -48,10 +48,15 @@ impl UvDeviceInfo { let mut cmd = uvio_uvdev_info::new_zeroed(); match uv.send_cmd(&mut cmd) { Ok(_) => Ok(cmd.into()), - Err(crate::Error::Io(e)) if e.raw_os_error() == Some(libc::ENOTTY) => Ok(Self { - supp_uvio_cmds: (UvDevice::ATTESTATION_NR as u64).into(), - supp_uv_cmds: None, - }), + Err(crate::Error::Io(e)) if e.raw_os_error() == Some(libc::ENOTTY) => { + let mut supp_uvio_cmds = Lsb0Flags64::default(); + supp_uvio_cmds.set_bit(UvDevice::ATTESTATION_NR); + + Ok(Self { + supp_uvio_cmds, + supp_uv_cmds: None, + }) + } Err(e) => Err(e), } }