diff mbox series

[2/4] s390x/css: fix NULL handling for CCW addresses

Message ID 20170908152446.14606-3-pasic@linux.vnet.ibm.com
State New
Headers show
Series None | expand

Commit Message

Halil Pasic Sept. 8, 2017, 3:24 p.m. UTC
Back then in the time of df1fe5bb49 ("s390: Virtual channel subsystem
support.", 2013-01-24) -EIO used to map to a channel-program check (via
the default label of the switch statement).  Then 2dc95b4cac
("s390x/3270: 3270 data stream handling", 2016-04-01) came along
and that changed dramatically.

Let us roll back this undesired side effect, and go back to
channel-program check.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Fixes: 2dc95b4cac "s390x/3270: 3270 data stream handling"
---

I'm not sure 0 as CCW address  it's strictly illegal. Yes 0 is an
unlikely address for a CCW but I would appreciate a PoP reference
clarifying this...

Another reason to not use Unix/POSIX error codes like this.
---
 hw/s390x/css.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cornelia Huck Sept. 11, 2017, 9:44 a.m. UTC | #1
On Fri,  8 Sep 2017 17:24:44 +0200
Halil Pasic <pasic@linux.vnet.ibm.com> wrote:

> Back then in the time of df1fe5bb49 ("s390: Virtual channel subsystem
> support.", 2013-01-24) -EIO used to map to a channel-program check (via
> the default label of the switch statement).  Then 2dc95b4cac
> ("s390x/3270: 3270 data stream handling", 2016-04-01) came along
> and that changed dramatically.
> 
> Let us roll back this undesired side effect, and go back to
> channel-program check.
> 
> Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
> Fixes: 2dc95b4cac "s390x/3270: 3270 data stream handling"
> ---
> 
> I'm not sure 0 as CCW address  it's strictly illegal. Yes 0 is an
> unlikely address for a CCW but I would appreciate a PoP reference
> clarifying this...

0 is not an address we can fetch from, I think that is enough to
trigger a channel-program check.

> 
> Another reason to not use Unix/POSIX error codes like this.
> ---
>  hw/s390x/css.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/s390x/css.c b/hw/s390x/css.c
> index 09f6ba0310..a44d87ab3e 100644
> --- a/hw/s390x/css.c
> +++ b/hw/s390x/css.c
> @@ -793,7 +793,7 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr,
>      CCW1 ccw;
>  
>      if (!ccw_addr) {
> -        return -EIO;
> +        return -EINVAL; /* channel-program check */
>      }
>      /* Check doubleword aligned and 31 or 24 (fmt 0) bit addressable. */
>      if (ccw_addr & (sch->ccw_fmt_1 ? 0x80000007 : 0xff000007)) {

Thanks, queued.
diff mbox series

Patch

diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 09f6ba0310..a44d87ab3e 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -793,7 +793,7 @@  static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr,
     CCW1 ccw;
 
     if (!ccw_addr) {
-        return -EIO;
+        return -EINVAL; /* channel-program check */
     }
     /* Check doubleword aligned and 31 or 24 (fmt 0) bit addressable. */
     if (ccw_addr & (sch->ccw_fmt_1 ? 0x80000007 : 0xff000007)) {