From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:50982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwPVT-0003h5-9i for qemu-devel@nongnu.org; Wed, 20 Feb 2019 05:53:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwPVS-0008Qn-Fx for qemu-devel@nongnu.org; Wed, 20 Feb 2019 05:53:39 -0500 Date: Wed, 20 Feb 2019 11:53:16 +0100 From: Cornelia Huck Message-ID: <20190220115316.3e471bff.cohuck@redhat.com> In-Reply-To: <20190220010232.18731-21-philmd@redhat.com> References: <20190220010232.18731-1-philmd@redhat.com> <20190220010232.18731-21-philmd@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 20/25] s390x/sclp: Use a const variable to improve readability List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Philippe =?UTF-8?B?TWF0aGlldS1EYXVkw6k=?= Cc: qemu-devel@nongnu.org, Prasad J Pandit , =?UTF-8?B?TWFyYy1BbmRyw6k=?= Lureau , Paolo Bonzini , Jason Wang , Anthony Perard , qemu-ppc@nongnu.org, Stefan Berger , David Gibson , Gerd Hoffmann , Zhang Chen , xen-devel@lists.xenproject.org, Samuel Thibault , Christian Borntraeger , Amit Shah , Li Zhijian , Corey Minyard , "Michael S. Tsirkin" , Paul Durrant , Halil Pasic , Stefano Stabellini , qemu-s390x@nongnu.org, Pavel Dovgalyuk On Wed, 20 Feb 2019 02:02:27 +0100 Philippe Mathieu-Daud=C3=A9 wrote: > We will reuse this variable in the next patch. >=20 > Signed-off-by: Philippe Mathieu-Daud=C3=A9 > --- > hw/char/sclpconsole-lm.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) >=20 > diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c > index dbc91a1e5b..49543e2c83 100644 > --- a/hw/char/sclpconsole-lm.c > +++ b/hw/char/sclpconsole-lm.c > @@ -210,13 +210,14 @@ static int process_mdb(SCLPEvent *event, MDBO *mdbo) > int rc; > int len; > uint8_t buffer[SIZE_BUFFER]; > - > - len =3D be16_to_cpu(mdbo->length); > - len -=3D sizeof(mdbo->length) + sizeof(mdbo->type) > + const size_t hlen =3D sizeof(mdbo->length) > + + sizeof(mdbo->type) > + sizeof(mdbo->mto.line_type_flags) > + sizeof(mdbo->mto.alarm_control) > + sizeof(mdbo->mto._reserved); > =20 > + len =3D be16_to_cpu(mdbo->length); > + len -=3D hlen; > assert(len <=3D SIZE_BUFFER); > =20 > /* convert EBCDIC SCLP contents to ASCII console message */ I'd probably merge this with the next patch, though. Reviewed-by: Cornelia Huck