Skip to content

Commit 5e1a99c

Browse files
svens-s390Alexander Gordeev
authored andcommitted
s390/3270: Fix buffer assignment
Since commit 1b2ac5a ("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: 1b2ac5a ("s390/3270: use new address translation helpers") Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Sven Schnelle <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 412050a commit 5e1a99c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/s390/char/raw3270.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ struct raw3270_request *raw3270_request_alloc(size_t size)
162162
/*
163163
* Setup ccw.
164164
*/
165-
rq->ccw.cda = virt_to_dma32(rq->buffer);
165+
if (rq->buffer)
166+
rq->ccw.cda = virt_to_dma32(rq->buffer);
166167
rq->ccw.flags = CCW_FLAG_SLI;
167168

168169
return rq;
@@ -188,7 +189,8 @@ int raw3270_request_reset(struct raw3270_request *rq)
188189
return -EBUSY;
189190
rq->ccw.cmd_code = 0;
190191
rq->ccw.count = 0;
191-
rq->ccw.cda = virt_to_dma32(rq->buffer);
192+
if (rq->buffer)
193+
rq->ccw.cda = virt_to_dma32(rq->buffer);
192194
rq->ccw.flags = CCW_FLAG_SLI;
193195
rq->rescnt = 0;
194196
rq->rc = 0;

0 commit comments

Comments
 (0)