s390/sclp: check sccb len before filling in data
authorCollin Walling <walling@linux.ibm.com>
Tue, 15 Sep 2020 19:44:12 +0000 (15:44 -0400)
committerCornelia Huck <cohuck@redhat.com>
Fri, 2 Oct 2020 11:52:49 +0000 (13:52 +0200)
commit0260b97824495ebfacfa8bbae0be10b0ef986bf6
treee545c3d6baddceebe7a45e9af548154203a8007a
parentc1db53a5910f988eeb32f031c53a50f3373fd824
s390/sclp: check sccb len before filling in data

The SCCB must be checked for a sufficient length before it is filled
with any data. If the length is insufficient, then the SCLP command
is suppressed and the proper response code is set in the SCCB header.

While we're at it, let's cleanup the length check by placing the
calculation inside a macro.

Fixes: 832be0d8a3bb ("s390x: sclp: Report insufficient SCCB length")
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-Id: <20200915194416.107460-5-walling@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
hw/s390x/sclp.c