Skip to contentSkip to conversation

librdmacm: fix compiler warning of void* arithmetic

PATCH In review Jonathan Rosser 3 participants 4 messages Oct 22, 2010 – Nov 1, 2010 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 librdmacm: fix compiler warning of void* arithmetic

Arithmetic on void* pointers generates a compiler warning, and projects that include rdma/rdma_verbs.h and compile with -Werror -Wall will fail to build.

---
 include/rdma/rdma_verbs.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/rdma/rdma_verbs.h +1 -1
index d75d906..853ef9b 100644
@@ -160,7 +160,7 @@ rdma_post_recv(struct rdma_cm_id *id, void *context, void *addr,
 {
 	struct ibv_sge sge;
 
-	assert((addr >= mr->addr) && ((addr + length) <= (mr->addr + mr->length)));
+	assert((addr >= mr->addr) && (((uint8_t*)addr + length) <= ((uint8_t*)mr->addr + mr->length)));
 	sge.addr = (uint64_t) (uintptr_t) addr;
 	sge.length = (uint32_t) length;
 	sge.lkey = mr->lkey;
Signature · 8 lines
1.7.0.4



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 22 lines · Jonathan Rosser

Arithmetic on void* pointers generates a compiler warning, and projects
that include rdma/rdma_verbs.h and compile with -Werror -Wall will fail
to build.

---
  include/rdma/rdma_verbs.h |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
include/rdma/rdma_verbs.h +1 -1
index d75d906..853ef9b 100644
@@ -160,7 +160,7 @@ rdma_post_recv(struct rdma_cm_id *id, void
 *context,
 void *addr,
  {
  	struct ibv_sge sge;
 
-	assert((addr >= mr->addr) && ((addr + length) <= (mr->addr + 
 mr->length)));
+	assert((addr >= mr->addr) && (((uint8_t*)addr + length) <= 
Quoted 15 lines

((uint8_t*)mr->addr + mr->length)));
sge.addr = (uint64_t) (uintptr_t) addr;
sge.length = (uint32_t) length;
sge.lkey = mr->lkey;

Signature · 9 lines
1.7.0.4



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma"
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Hi Jonathan,

I have found the same building error. Now it works fine.

Andrea Gozzelino

INFN - Laboratori Nazionali di Legnaro (LNL)
Viale dell'Universita' 2 -I-35020 - Legnaro (PD)- ITALIA
Office: E-101
Tel: +39 049 8068346
Fax: +39 049 641925
Mail: andrea.gozzelino-PK20h7lG/[email protected]
Cell: +39 3488245552

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Jonathan Rosser

Arithmetic on void* pointers generates a compiler warning, and projects that include rdma/rdma_verbs.h and compile with -Werror -Wall will fail to build.

---
 include/rdma/rdma_verbs.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/rdma/rdma_verbs.h +1 -1
index d75d906..853ef9b 100644
@@ -160,7 +160,7 @@ rdma_post_recv(struct rdma_cm_id *id, void *context, void *addr,
 {
        struct ibv_sge sge;
 
-       assert((addr >= mr->addr) && ((addr + length) <= (mr->addr + mr->length)));
+       assert((addr >= mr->addr) && (((uint8_t*)addr + length) <= ((uint8_t*)mr->addr + mr->length)));
        sge.addr = (uint64_t) (uintptr_t) addr;
        sge.length = (uint32_t) length;
        sge.lkey = mr->lkey;
Signature · 8 lines
1.7.0.4



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html