From nobody Mon Feb 9 11:29:36 2026 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1584818220; cv=none; d=zohomail.com; s=zohoarc; b=ThVvKILSSXM7+sXcG9Dv7cuGj0VjAUOucEUxKEG/vjow7upDwJhVFB40/66CYN21s8W23/q2x5ataJzckrzPBulDkiBl2Lrn6NOqrAiOLW1I5Do7lVuNDfalRMLIY/BKjz5l25nZcJhCMaEViyYn7KcKABaYj/W3CypyxTotL3Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584818220; 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=sspz/br+P8mUAXaacMtETm/32ruEWwdUnsySxlRkdEg=; b=fvqEx/7c6k602657P3ZDXmJepQTf2oPGWVKO9FVfyDw10pDiFAzvPWDIYnpd66C2w+Ych9mRbxLD4BEK5G7Fgm0skyn/IJcFUvqsPZ510wQnKUyCeTgodSkiLDrGHd2EOXh1YD0q+qNf8l6HNag+ZWEq1rueoZwx5ruA79BivU8= 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 1584818220498304.47753114543707; Sat, 21 Mar 2020 12:17:00 -0700 (PDT) Received: from localhost ([::1]:39922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFjcB-0001LP-AV for importer@patchew.org; Sat, 21 Mar 2020 15:16:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39595) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFjYj-0005Vb-AJ for qemu-devel@nongnu.org; Sat, 21 Mar 2020 15:13:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jFjYi-0005qD-9K for qemu-devel@nongnu.org; Sat, 21 Mar 2020 15:13:25 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:54547) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jFjYi-0005p4-3b for qemu-devel@nongnu.org; Sat, 21 Mar 2020 15:13:24 -0400 Received: by mail-wm1-x342.google.com with SMTP id f130so8833632wmf.4 for ; Sat, 21 Mar 2020 12:13:24 -0700 (PDT) Received: from localhost.localdomain ([37.142.144.12]) by smtp.gmail.com with ESMTPSA id i1sm15226252wrs.18.2020.03.21.12.13.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Mar 2020 12:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sspz/br+P8mUAXaacMtETm/32ruEWwdUnsySxlRkdEg=; b=gRXJS2wvF9x8E1wNK0xgIqCDDJm/HzlZT3vxrdSap0MObaE5Qd9Pmahl43/xswU7i2 l1hElMblmPyQXhnqAq0QFUpl+mnlctLKflOc5xoFOGfGcuUcqJQuPySStOy8UJfi7uF1 nY3A7fzNgpMP2ou1dbaclIobgHl+aKidC2sQhR0qtefkzhknJeAld7bFbUM3FN7AiKpa v1eAl8llG9H6ubtKLepFy78rbXrXcIKHlC4kONBHYPdXxdxGNHvrMoN/6UAVvhvOL/EE nSvR5kU/rTrflUR3RIIpndxE7uQfrNAU3Ayd8t144XE99sX43tF2VlvdLmqdBF1tmia7 yJPw== 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=sspz/br+P8mUAXaacMtETm/32ruEWwdUnsySxlRkdEg=; b=rD+9A+Vp/UTnSJlCFuFWShm+yOfdyyCsxHhsRCThNZvWKllTGIeEwBUvTXlF5hh+o1 SiVdSln27QlTEk1QsSbeOE8bgQ41rNfRbzjj1XATV93BmuwfbUpzDK8vvH77iSRGIZdl 1aGQ3BSanBhMAJ8ilpvKHyh3kI/iscGemvpMXW0H3Y1qlgNRZsUb76rIWku8K8iXZWI2 LKFPPXiqGfyg9c1F1Zy3iugKTJgxaJrAVFPJOZXsEwSzkt7danFKtNi5d540Ng0I70mI ZthZdvsU2oWmLuya/xmaeN8TAXQJ9erAutAc0YDcEPRArel2n/pthlkqNN3yeVtUZWyq H7Vg== X-Gm-Message-State: ANhLgQ29aj4Bp7p/auqvTJbhs65FTpHdUxBbOT7z6SXz7AmciLF/EngP 6OP7MnW1qNRcX3Sp468WvPi6O52v X-Google-Smtp-Source: ADFU+vvj0dx3RdKk1pibdINBNN/Bm2KEsW0U36u6py3iV6j2B/qOWPlgTtGMJEJjX6wNBtwlWZegpw== X-Received: by 2002:a7b:c305:: with SMTP id k5mr18431419wmj.189.1584818002856; Sat, 21 Mar 2020 12:13:22 -0700 (PDT) From: Marcel Apfelbaum To: qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [Qemu-devel] [PATCH PULL 4/4] hw/rdma: avoid suspicious strncpy() use Date: Sat, 21 Mar 2020 21:13:11 +0200 Message-Id: <20200321191311.31537-5-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200321191311.31537-1-marcel.apfelbaum@gmail.com> References: <20200321191311.31537-1-marcel.apfelbaum@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 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: jusual@redhat.com, stefanha@redhat.com, yuval.shaia.ml@gmail.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Stefan Hajnoczi gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1) with sanitizers enabled reports the following error: CC x86_64-softmmu/hw/rdma/vmw/pvrdma_dev_ring.o In file included from /usr/include/string.h:495, from include/qemu/osdep.h:101, from hw/rdma/vmw/pvrdma_dev_ring.c:16: In function =E2=80=98strncpy=E2=80=99, inlined from =E2=80=98pvrdma_ring_init=E2=80=99 at hw/rdma/vmw/pvrdma_d= ev_ring.c:33:5: /usr/include/bits/string_fortified.h:106:10: error: =E2=80=98__builtin_strn= cpy=E2=80=99 specified bound 32 equals destination size [-Werror=3Dstringop= -truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__de= st)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~ Use pstrcpy() instead of strncpy(). It is guaranteed to NUL-terminate strings. Signed-off-by: Stefan Hajnoczi Reviewed-by: Juan Quintela Reviewed-by: Yuval Shaia Message-Id: <20200316160702.478964-3-stefanha@redhat.com> Signed-off-by: Marcel Apfelbaum --- hw/rdma/vmw/pvrdma_dev_ring.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/rdma/vmw/pvrdma_dev_ring.c b/hw/rdma/vmw/pvrdma_dev_ring.c index c2b3dd70a9..c122fe7035 100644 --- a/hw/rdma/vmw/pvrdma_dev_ring.c +++ b/hw/rdma/vmw/pvrdma_dev_ring.c @@ -14,6 +14,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "hw/pci/pci.h" #include "cpu.h" #include "qemu/cutils.h" --=20 2.17.2