Message ID | 20240208-fix-copy-mcl-check-v1-1-6f89df85f9d3@samsung.com |
---|---|
State | New |
Headers | show |
Series | hw/nvme: fix invalid check on mcl | expand |
On 24-02-08 13:22:48, Klaus Jensen wrote: > From: Klaus Jensen <k.jensen@samsung.com> > > The number of logical blocks within a source range is converted into a > 1s based number at the time of parsing. However, when verifying the copy > length we add one again, causing the check against MCL to fail in error. > > Fixes: 381ab99d8587 ("hw/nvme: check maximum copy length (MCL) for COPY") > Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Hi Klaus, Reviewed-by: Minwoo Im <minwoo.im@samsung.com> Thanks! > --- > hw/nvme/ctrl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c > index f026245d1e9e..05c667158a3a 100644 > --- a/hw/nvme/ctrl.c > +++ b/hw/nvme/ctrl.c > @@ -2855,7 +2855,7 @@ static inline uint16_t nvme_check_copy_mcl(NvmeNamespace *ns, > uint32_t nlb; > nvme_copy_source_range_parse(iocb->ranges, idx, iocb->format, NULL, > &nlb, NULL, NULL, NULL); > - copy_len += nlb + 1; > + copy_len += nlb; > } > > if (copy_len > ns->id_ns.mcl) { > > --- > base-commit: 39a6e4f87e7b75a45b08d6dc8b8b7c2954c87440 > change-id: 20240208-fix-copy-mcl-check-3a6d95327154 > > Best regards, > -- > Klaus Jensen <k.jensen@samsung.com> > >
On Feb 8 21:33, Minwoo Im wrote: > On 24-02-08 13:22:48, Klaus Jensen wrote: > > From: Klaus Jensen <k.jensen@samsung.com> > > > > The number of logical blocks within a source range is converted into a > > 1s based number at the time of parsing. However, when verifying the copy > > length we add one again, causing the check against MCL to fail in error. > > > > Fixes: 381ab99d8587 ("hw/nvme: check maximum copy length (MCL) for COPY") > > Signed-off-by: Klaus Jensen <k.jensen@samsung.com> > > Hi Klaus, > > Reviewed-by: Minwoo Im <minwoo.im@samsung.com> > > Thanks! > Thanks Minwoo, applied to nvme-next!
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index f026245d1e9e..05c667158a3a 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -2855,7 +2855,7 @@ static inline uint16_t nvme_check_copy_mcl(NvmeNamespace *ns, uint32_t nlb; nvme_copy_source_range_parse(iocb->ranges, idx, iocb->format, NULL, &nlb, NULL, NULL, NULL); - copy_len += nlb + 1; + copy_len += nlb; } if (copy_len > ns->id_ns.mcl) {