[PATCH] nvmet: fix the error of point math issue

Guixin Liu kanie at linux.alibaba.com
Mon Nov 11 02:40:35 PST 2024


Fix the wrong place of parenthesis of ctrl_eds and data point in
nvmet_execute_pr_report(), switch to "void *" first and then do
the addtion.

Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>
---
 drivers/nvme/target/pr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c
index bef82135a0e7..550effcfb9ad 100644
--- a/drivers/nvme/target/pr.c
+++ b/drivers/nvme/target/pr.c
@@ -848,8 +848,8 @@ static void nvmet_execute_pr_report(struct nvmet_req *req)
 		/*
 		 * continue to get the number of all registrans.
 		 */
-		if ((void *)(ctrl_eds + sizeof(*ctrl_eds)) >
-			(void *)(data + num_bytes))
+		if (((void *)ctrl_eds + sizeof(*ctrl_eds)) >
+		    ((void *)data + num_bytes))
 			continue;
 		/*
 		 * Dynamic controller, set cntlid to 0xffff.
-- 
2.43.0




More information about the Linux-nvme mailing list