Skip to content

Commit

Permalink
nvme: use argconfig_parse_seen to check is entered parameter 'value' …
Browse files Browse the repository at this point in the history
…in set-feature

The value of NVME_FEAT_FID_TIMESTAMP cannot be set to 0 through 'set-feature -f 0xe -v 0'. 
using argconfig_parse_seen() can fix this issue
  • Loading branch information
XiaoyuanZhang authored Jul 18, 2024
1 parent ede9a5f commit 0425648
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -6415,7 +6415,7 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
* should use the buffer method if the value exceeds this
* length.
*/
if (cfg.feature_id == NVME_FEAT_FID_TIMESTAMP && cfg.value) {
if (cfg.feature_id == NVME_FEAT_FID_TIMESTAMP && argconfig_parse_seen(opts, "value")) {

Check failure on line 6418 in nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 103 exceeds 100 columns
memcpy(buf, &cfg.value, NVME_FEAT_TIMESTAMP_DATA_SIZE);
} else {
if (strlen(cfg.file))
Expand Down

0 comments on commit 0425648

Please sign in to comment.