From patchwork Wed Mar 4 15:33:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11420287 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 985B9930 for ; Wed, 4 Mar 2020 15:36:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F0D920870 for ; Wed, 4 Mar 2020 15:36:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JPz6Zqt7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F0D920870 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9W4g-0004JT-Gz for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Mar 2020 10:36:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45206) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9W1a-00070z-GD for qemu-devel@nongnu.org; Wed, 04 Mar 2020 10:33:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9W1Z-0003hf-GI for qemu-devel@nongnu.org; Wed, 04 Mar 2020 10:33:30 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:56205 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9W1Z-0003gW-Bz for qemu-devel@nongnu.org; Wed, 04 Mar 2020 10:33:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583336009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VSi8icYpglVwPM4o7Q8ZGmXm/EAEO/DibdkCD45Z2Kw=; b=JPz6Zqt7Tp1a/t+t+g9NatAjYa/57p3IkEI08zvMGQjRlSHYd/DJFCdk3iwskFShWKTxAj MatXEUtCqo51OjTn74tYrUEvjanV7MWZGoWPSFiwnPSWhCfW6zZVERw4sWhSNgfyuVivg3 OF5Ve/UJaYfG5XvNZda/x97LGPkvoG0= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-260-ABfHAalFMVeAdR_g3vSoQw-1; Wed, 04 Mar 2020 10:33:27 -0500 X-MC-Unique: ABfHAalFMVeAdR_g3vSoQw-1 Received: by mail-wm1-f70.google.com with SMTP id y7so1005998wmd.4 for ; Wed, 04 Mar 2020 07:33:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KkhqIVIgOTcLzuFywQWIieMxU39HVlXEuJIdDpMq2pg=; b=HFkFZPo6Z5PKbcsoyU3TABTw3bLgCHr3W9D7NF8o/VBJuCzNfssX2DFTUoG/oTWwyy xRj4z/jgKjVm+owpmbtrRRWa+ZXyaVjlL0irQjZzvpkz1gUa6Ewbhi2D5riMUrbD/pi+ XIq6KweXC3w35e9xfGCbxt0RI6/+oFy+puQdYk1OYSYYCSfPylnm/Z9ah1uXxu8ilue0 d1TAlnVwh+S618i4btxJX11dlOeAWH5o4yuJbjjKxMDdfHmxGbMosmZL1jOtlPVoPkQH ERJwFMGZKvLCSmDQaM/SfvCmtNb82MYDYMggkMM5IlNgtT+yO0Ste4lhim+TmzfUYW5z So0w== X-Gm-Message-State: ANhLgQ1X/SucUwAjpApiPyxzY3DIKM8TI4g0xljTjZxOGzwiLrvcOZeE JwWXAosLLM7GKC2JBxfODmSkcAUchEYaGcIDVhspASl9NSzt+lmyccjgQ1qg039LNxbJwkNvJ+l mPLs4nAPidmbQsTU= X-Received: by 2002:a1c:25c5:: with SMTP id l188mr4390999wml.105.1583336005985; Wed, 04 Mar 2020 07:33:25 -0800 (PST) X-Google-Smtp-Source: ADFU+vtwz9+DmWBd1+B9vH79rxKAxMTDcTxndbAh+V+CTSMCjRy09DnZptZdXUuzSXBw8b189ttXTw== X-Received: by 2002:a1c:25c5:: with SMTP id l188mr4390974wml.105.1583336005728; Wed, 04 Mar 2020 07:33:25 -0800 (PST) Received: from localhost.localdomain (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id t124sm5172965wmg.13.2020.03.04.07.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 07:33:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 2/5] hw/scsi/spapr_vscsi: Use SRP_MAX_IU_LEN instead of sizeof flexible array Date: Wed, 4 Mar 2020 16:33:08 +0100 Message-Id: <20200304153311.22959-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200304153311.22959-1-philmd@redhat.com> References: <20200304153311.22959-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , qemu-ppc@nongnu.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Replace sizeof() flexible arrays union srp_iu/viosrp_iu by the SRP_MAX_IU_LEN definition, which is what this code actually meant to use. Signed-off-by: Philippe Mathieu-Daudé --- hw/scsi/spapr_vscsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index 7d584e7732..7e397ed797 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -671,8 +671,8 @@ static void vscsi_process_login(VSCSIState *s, vscsi_req *req) */ rsp->req_lim_delta = cpu_to_be32(VSCSI_REQ_LIMIT-2); rsp->tag = tag; - rsp->max_it_iu_len = cpu_to_be32(sizeof(union srp_iu)); - rsp->max_ti_iu_len = cpu_to_be32(sizeof(union srp_iu)); + rsp->max_it_iu_len = cpu_to_be32(SRP_MAX_IU_LEN); + rsp->max_ti_iu_len = cpu_to_be32(SRP_MAX_IU_LEN); /* direct and indirect */ rsp->buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT); @@ -1088,7 +1088,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq) * in our 256 bytes IUs. If not we'll have to increase the size * of the structure. */ - if (crq->s.IU_length > sizeof(union viosrp_iu)) { + if (crq->s.IU_length > SRP_MAX_IU_LEN) { fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n", crq->s.IU_length); vscsi_put_req(req);