s390x: ipl: Consolidate iplb validity check into one function
It's nicer to just call one function than calling a function for each possible iplb type. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Reviewed-by: David Hildenbrand <david@redhat.com> Message-Id: <20200310090950.61172-1-frankja@linux.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
This commit is contained in:
parent
0a01e082a4
commit
94c21436e5
@ -173,16 +173,16 @@ static inline bool iplb_valid_len(IplParameterBlock *iplb)
|
||||
return be32_to_cpu(iplb->len) <= sizeof(IplParameterBlock);
|
||||
}
|
||||
|
||||
static inline bool iplb_valid_ccw(IplParameterBlock *iplb)
|
||||
static inline bool iplb_valid(IplParameterBlock *iplb)
|
||||
{
|
||||
return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_CCW_LEN &&
|
||||
iplb->pbt == S390_IPL_TYPE_CCW;
|
||||
}
|
||||
|
||||
static inline bool iplb_valid_fcp(IplParameterBlock *iplb)
|
||||
{
|
||||
return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_FCP_LEN &&
|
||||
iplb->pbt == S390_IPL_TYPE_FCP;
|
||||
switch (iplb->pbt) {
|
||||
case S390_IPL_TYPE_FCP:
|
||||
return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_FCP_LEN;
|
||||
case S390_IPL_TYPE_CCW:
|
||||
return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_CCW_LEN;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -117,7 +117,7 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)
|
||||
|
||||
cpu_physical_memory_read(addr, iplb, be32_to_cpu(iplb->len));
|
||||
|
||||
if (!iplb_valid_ccw(iplb) && !iplb_valid_fcp(iplb)) {
|
||||
if (!iplb_valid(iplb)) {
|
||||
env->regs[r1 + 1] = DIAG_308_RC_INVALID;
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user