From: Laiwenhu <93751545+Laiwenhu@users.noreply.github.com> Date: Thu, 23 Mar 2023 08:30:55 +0000 (+0800) Subject: nvme: validate storage tag size correctly X-Git-Tag: v2.4~11 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ec5a4001e319f303ef66b4aa08ed60793964ad29;p=users%2Fsagi%2Fnvme-cli.git nvme: validate storage tag size correctly 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 --- diff --git a/nvme.c b/nvme.c index 8a92ddce..a40a58c8 100644 --- 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: