public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Schlameuss <schlameuss@linux.ibm.com>
To: linux-s390@vger.kernel.org, kvm@vger.kernel.org
Cc: "Janosch Frank" <frankja@linux.ibm.com>,
	"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
	"Nico Böhr" <nrb@linux.ibm.com>,
	"David Hildenbrand" <david@kernel.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Christoph Schlameuss" <schlameuss@linux.ibm.com>
Subject: [kvm-unit-tests PATCH v4 3/6] s390x: sclp: Check sclp byte before reading feature bits
Date: Thu, 23 Apr 2026 16:26:47 +0200	[thread overview]
Message-ID: <20260423-vsie-stfle-fac-v4-3-32943fe43394@linux.ibm.com> (raw)
In-Reply-To: <20260423-vsie-stfle-fac-v4-0-32943fe43394@linux.ibm.com>

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 <frankja@linux.ibm.com>
Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
---
 lib/s390x/sclp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index 2f902e39e785..1ffcf448e558 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


  parent reply	other threads:[~2026-04-23 14:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 14:26 [kvm-unit-tests PATCH v4 0/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
2026-04-23 14:26 ` [kvm-unit-tests PATCH v4 1/6] s390x: snippets: Add reset_guest() to lib Christoph Schlameuss
2026-04-23 14:26 ` [kvm-unit-tests PATCH v4 2/6] s390x: sclp: Remove unnecessary padding from struct sclp_facilities Christoph Schlameuss
2026-04-23 14:26 ` Christoph Schlameuss [this message]
2026-04-23 14:26 ` [kvm-unit-tests PATCH v4 4/6] s390x: sclp: Use sclp_feat_check directly to read DIAG318 feature bit Christoph Schlameuss
2026-04-23 14:46   ` Janosch Frank
2026-04-23 14:26 ` [kvm-unit-tests PATCH v4 5/6] s390x: sclp: Add detection of alternate STFLE facilities Christoph Schlameuss
2026-04-23 14:45   ` Janosch Frank
2026-04-23 14:26 ` [kvm-unit-tests PATCH v4 6/6] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260423-vsie-stfle-fac-v4-3-32943fe43394@linux.ibm.com \
    --to=schlameuss@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox