]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: validate storage tag size correctly
authorLaiwenhu <93751545+Laiwenhu@users.noreply.github.com>
Thu, 23 Mar 2023 08:30:55 +0000 (16:30 +0800)
committerDaniel Wagner <dwagner@suse.de>
Mon, 27 Mar 2023 09:58:29 +0000 (11:58 +0200)
The minimum and maximum value for the tag size are not correct
for the 64b case. Update them according the specification.

See also 'Figure 101: Extended LBA Format Data Structure, NVM Command
Set Specific' in NVM Command Set Specification.

[dwagner: updated commit message]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme.c

diff --git a/nvme.c b/nvme.c
index 8a92ddceb27a3393b5980c8361228202dce733d1..a40a58c8a94584f8514f379d2e1ca25fac3149b0 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -6390,7 +6390,7 @@ static int invalid_tags(__u64 storage_tag, __u64 ref_tag, __u8 sts, __u8 pif)
                        result = 1;
                break;
        case 2:
-               if (sts > 0 && ref_tag >= (1LL << (64 - sts)))
+               if (sts > 0 && ref_tag >= (1LL << (48 - sts)))
                        result = 1;
                break;
        default: