From a87d8a45a2682a68c9af1dd6aacee790c186e247 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 29 Sep 2016 13:23:56 -0700 Subject: [PATCH] iscsi: replace incorrect off_t with ptrdiff_t This code calculates the difference between two pointers and then stores it in an off_t, which is intended for file offsets. In this particular case, the offset will never be large enough to overflow off_t, but use the correct ptrdiff_t type anyway. Change-Id: I6b159bf0286a7f5962d08b9894538f4d99c8647b Signed-off-by: Daniel Verkamp --- lib/iscsi/iscsi_subsystem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/iscsi/iscsi_subsystem.c b/lib/iscsi/iscsi_subsystem.c index bdea67e6f..aeb9a96f3 100644 --- a/lib/iscsi/iscsi_subsystem.c +++ b/lib/iscsi/iscsi_subsystem.c @@ -54,6 +54,7 @@ #include #include +#include #include #include "iscsi/iscsi.h" @@ -319,7 +320,7 @@ spdk_mobj_ctor(struct rte_mempool *mp, __attribute__((unused)) void *arg, { struct spdk_mobj *m = _m; uint64_t *phys_addr; - off_t off; + ptrdiff_t off; m->mp = mp; m->buf = (uint8_t *)m + sizeof(struct spdk_mobj);