Re: [PATCH v2 2/4] s390x: sclp: boundary check

2019-09-27 Thread Christian Borntraeger



On 27.09.19 15:33, Claudio Imbrenda wrote:
> From: Janosch Frank 
> 
> All sclp codes need to be checked for page boundary violations.
> 
> Signed-off-by: Janosch Frank 
> Reviewed-by: Jason J. Herne 
> ---
>  hw/s390x/sclp.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
> index 95ebfe7..73244c9 100644
> --- a/hw/s390x/sclp.c
> +++ b/hw/s390x/sclp.c
> @@ -234,6 +234,11 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb, 
> uint32_t code)
>  goto out_write;
>  }
>  
> +if ((sccb + be16_to_cpu(work_sccb.h.length)) > ((sccb & PAGE_MASK) + 
> PAGE_SIZE)) {
> +work_sccb.h.response_code = 
> cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VIOLATION);
> +goto out_write;
> +}
> +
>  sclp_c->execute(sclp, _sccb, code);
>  out_write:
>  cpu_physical_memory_write(sccb, _sccb,
>

checkpatch complains about the line length, but splitting makes it really
less readable.

Thanks applied. 




Re: [PATCH v2 2/4] s390x: sclp: boundary check

2019-09-27 Thread David Hildenbrand
On 27.09.19 15:33, Claudio Imbrenda wrote:
> From: Janosch Frank 
> 
> All sclp codes need to be checked for page boundary violations.
> 
> Signed-off-by: Janosch Frank 
> Reviewed-by: Jason J. Herne 
> ---
>  hw/s390x/sclp.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
> index 95ebfe7..73244c9 100644
> --- a/hw/s390x/sclp.c
> +++ b/hw/s390x/sclp.c
> @@ -234,6 +234,11 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb, 
> uint32_t code)
>  goto out_write;
>  }
>  
> +if ((sccb + be16_to_cpu(work_sccb.h.length)) > ((sccb & PAGE_MASK) + 
> PAGE_SIZE)) {
> +work_sccb.h.response_code = 
> cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VIOLATION);
> +goto out_write;
> +}
> +
>  sclp_c->execute(sclp, _sccb, code);
>  out_write:
>  cpu_physical_memory_write(sccb, _sccb,
> 

Reviewed-by: David Hildenbrand 

-- 

Thanks,

David / dhildenb



[PATCH v2 2/4] s390x: sclp: boundary check

2019-09-27 Thread Claudio Imbrenda
From: Janosch Frank 

All sclp codes need to be checked for page boundary violations.

Signed-off-by: Janosch Frank 
Reviewed-by: Jason J. Herne 
---
 hw/s390x/sclp.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 95ebfe7..73244c9 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -234,6 +234,11 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb, 
uint32_t code)
 goto out_write;
 }
 
+if ((sccb + be16_to_cpu(work_sccb.h.length)) > ((sccb & PAGE_MASK) + 
PAGE_SIZE)) {
+work_sccb.h.response_code = 
cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VIOLATION);
+goto out_write;
+}
+
 sclp_c->execute(sclp, _sccb, code);
 out_write:
 cpu_physical_memory_write(sccb, _sccb,
-- 
2.7.4