mana_gd_write_client_oob() in gdma_main.c, I see that the original code
used: -> ptr = wqe_ptr + sizeof(header);

However, since header is a pointer to struct gdma_wqe, would not this
expression evaluate to the size of the pointer itself (typically 8 bytes
on 64-bit systems)
rather than the actual size of the structure?

Should it be the correct expression -> ptr = wqe_ptr + sizeof(*header);
to accurately skip over the size of the structure that header points to?

Even though sizeof(header) and sizeof(*header) may both return 8 in this
case by coincidence.
but that seems unintentional or potentially misleading. Apologies if I
misunderstood that context.

Thanks,
Alok
---
 drivers/net/ethernet/microsoft/mana/gdma_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c 
b/drivers/net/ethernet/microsoft/mana/gdma_main.c
index 3504507477c60..df4ee8c23bcbb 100644
--- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
+++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
@@ -1086,7 +1086,7 @@ static u32 mana_gd_write_client_oob(const struct 
gdma_wqe_request *wqe_req,
         * to one Basic Unit (i.e. 32 bytes), so the pointer can't go beyond
         * the queue memory buffer boundary.
         */
-       ptr = wqe_ptr + sizeof(header);
+       ptr = wqe_ptr + sizeof(*header);
 
        if (wqe_req->inline_oob_data && wqe_req->inline_oob_size > 0) {
                memcpy(ptr, wqe_req->inline_oob_data, wqe_req->inline_oob_size);
@@ -1096,7 +1096,7 @@ static u32 mana_gd_write_client_oob(const struct 
gdma_wqe_request *wqe_req,
                               client_oob_size - wqe_req->inline_oob_size);
        }
 
-       return sizeof(header) + client_oob_size;
+       return sizeof(*header) + client_oob_size;
 }
 
 static void mana_gd_write_sgl(struct gdma_queue *wq, u8 *wqe_ptr,
-- 
2.46.0


Reply via email to