Skip to content

Conversation

@ikegami-t
Copy link
Contributor

If nvme_identify_csi_ns() failed so caused floating point exception.

If nvme_identify_csi_ns() failed so caused floating point exception.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
nblocks = cfg.block_count;
} else {
/* Get the required block count. Note this is a zeroes based value. */
nblocks = ((buffer_size + (logical_block_size - 1)) / logical_block_size) - 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a function fails, in this case get_pi_info, it should not touch the output variables. Only on success it should update it. So I don't think there is need to change the above code.

Though I agree we should not blindly use logical_block_size here. I suggest to add a check here, when logical_block_size is 0, issue an error message an abort the operation. In this case without a valid logical_block_size, thus it's not possible calculate the nblocks value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example the read command below behavior was changed with before but is this expected? (Previously it was able to read the data and currently exception errror caused then it will be changed to return the error by the fix mentioned.)

nvme read /dev/nvme1n1 -z 0x100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants