Commit 5e1a99cf authored by Sven Schnelle's avatar Sven Schnelle Committed by Alexander Gordeev
Browse files

s390/3270: Fix buffer assignment



Since commit 1b2ac5a6 ("s390/3270: use new address translation
helpers") rq->buffer is passed unconditionally to virt_to_dma32().
The 3270 driver allocates requests without buffer, so the value passed
to virt_to_dma32 might be NULL. Check for NULL before assigning.

Fixes: 1b2ac5a6 ("s390/3270: use new address translation helpers")
Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
parent 412050af
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@ struct raw3270_request *raw3270_request_alloc(size_t size)
	/*
	 * Setup ccw.
	 */
	if (rq->buffer)
		rq->ccw.cda = virt_to_dma32(rq->buffer);
	rq->ccw.flags = CCW_FLAG_SLI;

@@ -188,6 +189,7 @@ int raw3270_request_reset(struct raw3270_request *rq)
		return -EBUSY;
	rq->ccw.cmd_code = 0;
	rq->ccw.count = 0;
	if (rq->buffer)
		rq->ccw.cda = virt_to_dma32(rq->buffer);
	rq->ccw.flags = CCW_FLAG_SLI;
	rq->rescnt = 0;