* [PATCH] vfio-ccw: Fix the conversion of Format-0 CCWs to Format-1
@ 2019-07-02 18:09 Eric Farman
2019-07-03 9:07 ` Cornelia Huck
0 siblings, 1 reply; 3+ messages in thread
From: Eric Farman @ 2019-07-02 18:09 UTC (permalink / raw)
To: Cornelia Huck, Farhan Ali; +Cc: Halil Pasic, linux-s390, kvm, Eric Farman
When processing Format-0 CCWs, we use the "len" variable as the
number of CCWs to convert to Format-1. But that variable
contains zero here, and is not a meaningful CCW count until
ccwchain_calc_length() returns. Since that routine requires and
expects Format-1 CCWs to identify the chaining behavior, the
format conversion must be done first.
Convert the 2KB we copied even if it's more than we need.
Fixes: 7f8e89a8f2fd ("vfio-ccw: Factor out the ccw0-to-ccw1 transition")
Reported-by: Farhan Ali <alifm@linux.ibm.com>
Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
drivers/s390/cio/vfio_ccw_cp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c
index 9cddc1288059..a870bde10445 100644
--- a/drivers/s390/cio/vfio_ccw_cp.c
+++ b/drivers/s390/cio/vfio_ccw_cp.c
@@ -431,7 +431,7 @@ static int ccwchain_handle_ccw(u32 cda, struct channel_program *cp)
/* Convert any Format-0 CCWs to Format-1 */
if (!cp->orb.cmd.fmt)
- convert_ccw0_to_ccw1(cp->guest_cp, len);
+ convert_ccw0_to_ccw1(cp->guest_cp, CCWCHAIN_LEN_MAX);
/* Count the CCWs in the current chain */
len = ccwchain_calc_length(cda, cp);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] vfio-ccw: Fix the conversion of Format-0 CCWs to Format-1
2019-07-02 18:09 [PATCH] vfio-ccw: Fix the conversion of Format-0 CCWs to Format-1 Eric Farman
@ 2019-07-03 9:07 ` Cornelia Huck
2019-07-05 6:10 ` Cornelia Huck
0 siblings, 1 reply; 3+ messages in thread
From: Cornelia Huck @ 2019-07-03 9:07 UTC (permalink / raw)
To: Eric Farman; +Cc: Farhan Ali, Halil Pasic, linux-s390, kvm
On Tue, 2 Jul 2019 20:09:28 +0200
Eric Farman <farman@linux.ibm.com> wrote:
> When processing Format-0 CCWs, we use the "len" variable as the
> number of CCWs to convert to Format-1. But that variable
> contains zero here, and is not a meaningful CCW count until
> ccwchain_calc_length() returns. Since that routine requires and
> expects Format-1 CCWs to identify the chaining behavior, the
> format conversion must be done first.
The usage of the 'len' variable in the function is a bit confusing
anyway.
>
> Convert the 2KB we copied even if it's more than we need.
>
> Fixes: 7f8e89a8f2fd ("vfio-ccw: Factor out the ccw0-to-ccw1 transition")
> Reported-by: Farhan Ali <alifm@linux.ibm.com>
> Signed-off-by: Eric Farman <farman@linux.ibm.com>
> ---
> drivers/s390/cio/vfio_ccw_cp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c
> index 9cddc1288059..a870bde10445 100644
> --- a/drivers/s390/cio/vfio_ccw_cp.c
> +++ b/drivers/s390/cio/vfio_ccw_cp.c
> @@ -431,7 +431,7 @@ static int ccwchain_handle_ccw(u32 cda, struct channel_program *cp)
>
> /* Convert any Format-0 CCWs to Format-1 */
> if (!cp->orb.cmd.fmt)
> - convert_ccw0_to_ccw1(cp->guest_cp, len);
> + convert_ccw0_to_ccw1(cp->guest_cp, CCWCHAIN_LEN_MAX);
>
> /* Count the CCWs in the current chain */
> len = ccwchain_calc_length(cda, cp);
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vfio-ccw: Fix the conversion of Format-0 CCWs to Format-1
2019-07-03 9:07 ` Cornelia Huck
@ 2019-07-05 6:10 ` Cornelia Huck
0 siblings, 0 replies; 3+ messages in thread
From: Cornelia Huck @ 2019-07-05 6:10 UTC (permalink / raw)
To: Eric Farman; +Cc: Farhan Ali, Halil Pasic, linux-s390, kvm
On Wed, 3 Jul 2019 11:07:04 +0200
Cornelia Huck <cohuck@redhat.com> wrote:
> On Tue, 2 Jul 2019 20:09:28 +0200
> Eric Farman <farman@linux.ibm.com> wrote:
>
> > When processing Format-0 CCWs, we use the "len" variable as the
> > number of CCWs to convert to Format-1. But that variable
> > contains zero here, and is not a meaningful CCW count until
> > ccwchain_calc_length() returns. Since that routine requires and
> > expects Format-1 CCWs to identify the chaining behavior, the
> > format conversion must be done first.
>
> The usage of the 'len' variable in the function is a bit confusing
> anyway.
>
> >
> > Convert the 2KB we copied even if it's more than we need.
> >
> > Fixes: 7f8e89a8f2fd ("vfio-ccw: Factor out the ccw0-to-ccw1 transition")
> > Reported-by: Farhan Ali <alifm@linux.ibm.com>
> > Signed-off-by: Eric Farman <farman@linux.ibm.com>
> > ---
> > drivers/s390/cio/vfio_ccw_cp.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c
> > index 9cddc1288059..a870bde10445 100644
> > --- a/drivers/s390/cio/vfio_ccw_cp.c
> > +++ b/drivers/s390/cio/vfio_ccw_cp.c
> > @@ -431,7 +431,7 @@ static int ccwchain_handle_ccw(u32 cda, struct channel_program *cp)
> >
> > /* Convert any Format-0 CCWs to Format-1 */
> > if (!cp->orb.cmd.fmt)
> > - convert_ccw0_to_ccw1(cp->guest_cp, len);
> > + convert_ccw0_to_ccw1(cp->guest_cp, CCWCHAIN_LEN_MAX);
> >
> > /* Count the CCWs in the current chain */
> > len = ccwchain_calc_length(cda, cp);
>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
And queued.
I'll send a pull req for this now; we can always do a second round for
the other patches.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-05 6:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 18:09 [PATCH] vfio-ccw: Fix the conversion of Format-0 CCWs to Format-1 Eric Farman
2019-07-03 9:07 ` Cornelia Huck
2019-07-05 6:10 ` Cornelia Huck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).