@@ -49,17 +49,16 @@ int win_scm2_ioctl_passthrough_cmd(unsigned short nfit_handle,
49
49
* p_dsm_status = 0 ;
50
50
CR_DSM_PASS_THROUGH_IOCTL ioctl_data ;
51
51
52
- // Because the CR_DSM_PASS_THROUGH_IOCTL struct has a byte for the input and output payloads
52
+ // Because the CR_DSM_PASS_THROUGH_IOCTL struct has a byte for the input and output payloads
53
53
// already, we need to subtract those bytes from the total buffer size
54
- ioctl_data .InputDataSize = sizeof (NVDIMM_PASSTHROUGH_IN ) +
55
- input_payload_size - 1 ; // minus 1 byte no padding cause the struct is packed
56
- if (ioctl_data .InputDataSize < 12 )
57
- ioctl_data .InputDataSize = 12 ; // Microsoft driver expects 12 bytes
58
-
59
- ioctl_data .OutputDataSize = sizeof (NVDIMM_PASSTHROUGH_OUT ) +
60
- output_payload_size - 1 ; // minus 1 byte no padding cause the struct is packed
61
- if (ioctl_data .OutputDataSize < 12 )
62
- ioctl_data .OutputDataSize = 12 ; // Microsoft driver expects 12 bytes
54
+ ioctl_data .InputDataSize = sizeof (NVDIMM_PASSTHROUGH_IN ) +
55
+ input_payload_size - 1 ; // minus 1 byte no padding cause the struct is packed
56
+ if (input_payload_size == 0 )
57
+ ioctl_data .InputDataSize += 4 ; // Microsoft driver expects 12 bytes
58
+ ioctl_data .OutputDataSize = sizeof (NVDIMM_PASSTHROUGH_OUT ) +
59
+ output_payload_size - 1 ; // minus 1 byte no padding cause the struct is packed
60
+ if (output_payload_size == 0 )
61
+ ioctl_data .OutputDataSize += 4 ; // Microsoft driver expects 12 bytes
63
62
64
63
SCM_LOG_INFO_F ("buf_size (%xh, %xh): in %d, out %d" , op_code , sub_op_code ,
65
64
(int )ioctl_data .InputDataSize , (int )ioctl_data .OutputDataSize );
0 commit comments