Skip to content

Commit 0979f22

Browse files
xyzhang-upigaw
authored andcommitted
nvme: use argconfig_parse_seen to check conditions
The value of NVME_FEAT_FID_TIMESTAMP cannot be set to 0 through 'set-feature /dev/nvmeX -f 0xe -v 0'. using argconfig_parse_seen() can fix this issue. Signed-off-by: Xiaoyuan Zhang <zhxiaoy@outlook.com>
1 parent ede9a5f commit 0979f22

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nvme.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -6415,7 +6415,8 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
64156415
* should use the buffer method if the value exceeds this
64166416
* length.
64176417
*/
6418-
if (cfg.feature_id == NVME_FEAT_FID_TIMESTAMP && cfg.value) {
6418+
if (cfg.feature_id == NVME_FEAT_FID_TIMESTAMP &&
6419+
argconfig_parse_seen(opts, "value")) {
64196420
memcpy(buf, &cfg.value, NVME_FEAT_TIMESTAMP_DATA_SIZE);
64206421
} else {
64216422
if (strlen(cfg.file))

0 commit comments

Comments
 (0)