[kvm-unit-tests GIT PULL 07/13] s390x: sclp: Check sclp byte before reading feature bits
Janosch Frank <[email protected]>
| Newsgroups | org.kernel.vger.kvm,org.kernel.vger.linux-s390 |
|---|---|
| Message-ID | <[email protected]> |
From: Christoph Schlameuss <[email protected]> Improve the readability and simplicity of the code in sclp_facilities_setup() by moving the check for availabity of feature bits into sclp_feat_check(). Suggested-by: Janosch Frank <[email protected]> Reviewed-by: Nico Boehr <[email protected]> Signed-off-by: Christoph Schlameuss <[email protected]> Signed-off-by: Janosch Frank <[email protected]> --- lib/s390x/sclp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c index 2f902e39..1ffcf448 100644 --- a/lib/s390x/sclp.c +++ b/lib/s390x/sclp.c @@ -142,6 +142,9 @@ static bool sclp_feat_check(int byte, int bit) { uint8_t *rib = (uint8_t *)read_info; + if (read_info->offset_cpu <= byte) + return false; + return !!(rib[byte] & (0x80 >> bit)); } -- 2.53.0