diff --git a/include/scsi-lowlevel.h b/include/scsi-lowlevel.h index 9d25b47..53b4118 100644 --- a/include/scsi-lowlevel.h +++ b/include/scsi-lowlevel.h @@ -299,11 +299,6 @@ struct scsi_data { unsigned char *data; }; -struct scsi_allocated_memory { - struct scsi_allocated_memory *next; - void *ptr; -}; - enum scsi_residual { SCSI_RESIDUAL_NO_RESIDUAL = 0, SCSI_RESIDUAL_UNDERFLOW, diff --git a/lib/scsi-lowlevel.c b/lib/scsi-lowlevel.c index 3f8020e..45d516e 100644 --- a/lib/scsi-lowlevel.c +++ b/lib/scsi-lowlevel.c @@ -39,6 +39,10 @@ #include "scsi-lowlevel.h" #include "iscsi-private.h" +struct scsi_allocated_memory { + struct scsi_allocated_memory *next; + char buf[0]; +}; void scsi_free_scsi_task(struct scsi_task *task) @@ -64,9 +68,8 @@ scsi_malloc(struct scsi_task *task, size_t size) return NULL; } memset(mem, 0, sizeof(struct scsi_allocated_memory) + size); - mem->ptr = (void *) ((uintptr_t)mem + sizeof(struct scsi_allocated_memory)); SLIST_ADD(&task->mem, mem); - return mem->ptr; + return &mem->buf[0]; } struct value_string {