From nobody Thu Nov 13 23:19:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583397208; cv=none; d=zohomail.com; s=zohoarc; b=cySgxq8AQSWBnxvxvsvJHfEej3GoO4CXMA7hzdAmq08ky2NXqVGs+CkVcwo84QDcMbhCHFKuIHXhtDDEQHKaKIhsSx9/qWrg1H4lBuB5QfCNhqH/ZcME4eFarD1c/o+MPycZGO7SfynJAmYTiO8eEXT8DAaEvJhyd7vdxTQApCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583397208; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yA3uLqLrMH4DadSPYrDFTonaKu32GW1DkxhKKfxoUes=; b=f95STu/4EF+Qt/mkhJttcrwu2Gq3vLdUarctPstZVwD3RbjhOer3zuqy7fXrXNkx8kmuGXHSfZ3smnCp6qQvF2U1qVdF5R1wlPeMcEkJ+7lsMuwyyEFjjCmZ9MitbOdTGQcJ8ybfLiTpAgmx4ruPifZ9kzWyz9WvmLsCuG+8RaI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583397208556485.0601640558357; Thu, 5 Mar 2020 00:33:28 -0800 (PST) Received: from localhost ([::1]:44946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lwc-0001QC-Gz for importer@patchew.org; Thu, 05 Mar 2020 03:33:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9lv7-0007yQ-D4 for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:31:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9lv6-0007q1-BQ for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:31:53 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:38589 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 1j9lv6-0007pl-8L for qemu-devel@nongnu.org; Thu, 05 Mar 2020 03:31:52 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-tZR1ehWUMb-1QCPgkLo5ng-1; Thu, 05 Mar 2020 03:31:50 -0500 Received: by mail-wm1-f71.google.com with SMTP id y18so2604297wmi.1 for ; Thu, 05 Mar 2020 00:31:50 -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 f15sm26583920wru.83.2020.03.05.00.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 00:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583397111; 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=yA3uLqLrMH4DadSPYrDFTonaKu32GW1DkxhKKfxoUes=; b=T+tDiZn4dn/Kr2VcWnOV53WFf8pVOxDc/8vyQHUcVyOZoHAMK+JWAdN/1Bc4onwhHNuS7k TtJKer0gZ4HBshcI4zffUzNmGfpgHns3jGBSnw8/WPogkwVr/7YgyhkL5av4n2XP8oHWZI 5nAWfTRVI4Yq2qXhBoAK7H8ZEbYEZYI= X-MC-Unique: tZR1ehWUMb-1QCPgkLo5ng-1 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=VKQxZm6oD2b2bzfClTv2OE2sVH6+fKk9xz2Zrpce/2w=; b=BUHNMaDDEmvEubH28IHVxVrnU2/gZpzpEsVXxpZkwe6NadpgN/H2hd0EfbNnz04VLL JuxcPeHz8AUqH1K4Rwkg1PGFkfM8N2sDbhnxMdxp0pT0lWd1rzPRBD7J8X6Mj0rO1oCU hS5s1zh3h1B0MHZcDuQlJT2UhXVR/Ft4JsnBg0fxeFZMr4e2mfilO6Q4SlohLb2d5ytW uOmToP+C8nzrFMHQNC7mxBDpS3F6nq0VVHIrhlCIfDxxRWQt+sQTX1Vv+5Mfs6kv/JDC Ne1XmQllm7etTaLDqAcVELHBFxibi/ElGN2jnmR3Be64As3Mr/+XpfbsyB9iY1tRQMWN 57MA== X-Gm-Message-State: ANhLgQ0ORBJQlT5vc64sWfGX8A6QgySwFqnssh03rwVpgCKsxAAuz/3w AOedMpz3iYQZu1e2FBbz4NnV3XO0mtMQcXpMSuSTN1BQUglrYU7xLnmrwVDUu1hYeiuHtX0bX9G ufDKnZ7n/06lN6ic= X-Received: by 2002:adf:e9c9:: with SMTP id l9mr8947638wrn.356.1583397108646; Thu, 05 Mar 2020 00:31:48 -0800 (PST) X-Google-Smtp-Source: ADFU+vsUsw5R1leZm5aRmP0ydzwOEndB9/plL1G0/5f4GqJJXebWrX+QpOUC63nFFMSf57K1JhLMgw== X-Received: by 2002:adf:e9c9:: with SMTP id l9mr8947623wrn.356.1583397108475; Thu, 05 Mar 2020 00:31:48 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [MERGED PATCH v2 2/5] hw/scsi/spapr_vscsi: Use SRP_MAX_IU_LEN instead of sizeof flexible array Date: Thu, 5 Mar 2020 09:31:32 +0100 Message-Id: <20200305083135.8270-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200305083135.8270-1-philmd@redhat.com> References: <20200305083135.8270-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" 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=C3=A9 --- Patch already applied to ppc-for-5.0. 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_re= q *req) */ rsp->req_lim_delta =3D cpu_to_be32(VSCSI_REQ_LIMIT-2); rsp->tag =3D tag; - rsp->max_it_iu_len =3D cpu_to_be32(sizeof(union srp_iu)); - rsp->max_ti_iu_len =3D cpu_to_be32(sizeof(union srp_iu)); + rsp->max_it_iu_len =3D cpu_to_be32(SRP_MAX_IU_LEN); + rsp->max_ti_iu_len =3D cpu_to_be32(SRP_MAX_IU_LEN); /* direct and indirect */ rsp->buf_fmt =3D cpu_to_be16(SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_IN= DIRECT); =20 @@ -1088,7 +1088,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_cr= q *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); --=20 2.21.1