From nobody Tue Feb 10 19:08:06 2026 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1601049120; cv=none; d=zohomail.com; s=zohoarc; b=THv48Ilhhfn/H5k3z/RA6RMSywJMsmaoaVCA8pnfZIQoH2VfABrUQF9c8TKZY7OphysJfJgan6Aa+lKbfATgXbXzQLN+z5nKUbzD0pEfqSM//M4GCRCm5ViSwPUyOzdi8uYNxnNc4yU3rNMu2nc+f5X94yZCxqlCKjaOqrT2Ta8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601049120; 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=z2OtAFTh3+9q2/zKqbcEllbBFvpVmRkFnnE3OIbznwA=; b=W2JfOtlcN9eJra7PV+3cRKcM21AcKFw1ESShJr9UirQ2pHzWvn8AGs5rLMcoGFO3Fyh+H/rPrje+Pu8SPIi5/FwEf/UBqU7+qRmdjB6CwYURbUKOtLh+PcNcMNHrp5ASM60kybrwhUXXcX+vltaPUoLdU12TQB7o5VB03vnxWlQ= 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 1601049120187221.91977482742607; Fri, 25 Sep 2020 08:52:00 -0700 (PDT) Received: from localhost ([::1]:41246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLq0s-0004bI-Lb for importer@patchew.org; Fri, 25 Sep 2020 11:51:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLpps-0002jB-9u for qemu-devel@nongnu.org; Fri, 25 Sep 2020 11:40:36 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:40454) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLppq-0007ax-B2 for qemu-devel@nongnu.org; Fri, 25 Sep 2020 11:40:36 -0400 Received: by mail-wr1-x432.google.com with SMTP id j2so4071527wrx.7 for ; Fri, 25 Sep 2020 08:40:33 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o4sm3155038wru.55.2020.09.25.08.40.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2020 08:40:30 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C29881FF90; Fri, 25 Sep 2020 16:40:28 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z2OtAFTh3+9q2/zKqbcEllbBFvpVmRkFnnE3OIbznwA=; b=CmsIsTbzgqI2HXh1gv/izniCtpOZwttxLBTjiax52Ri6U8MMtTfaarBf0QmUiazJlO s9Ar1o2FNDwRUBd9j9QQJZhAsTmDRbp4kJS/x2kDjd/q1gywrjiRYG8FxZbowAGsMwSW Xah9w+VBFZV1z0CQ4f+Gm+bUqlWBWK/QVJD7tuJNuR8eu7leYrgFRYf2OzvNe0nwcc2/ QFdeQFCVOcQ8NDnYcXYczsW4WAHzY/pvoAq3tO421mkQzhUFW2/nRaKuNUUcNvOSpjWT AylSeYypYAsltCnWIyaDwitvJBiMfVJq9MGvqt51t02ayB8LcUdv9QOWuzrGtjFTC5RX P2NQ== 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=z2OtAFTh3+9q2/zKqbcEllbBFvpVmRkFnnE3OIbznwA=; b=KTQ0xcvqCA6WUriiLPhXRk15RvkErY15e4H7scnw9txqb7yXQjsLHatm4ZOvlX3Xpy F4Sdnw5bh6JoeV60xLEWd0qGTAACuiQOWha9r/ZI5H1IZKwIbKN7k9PRE/TBIgNRa8yN RwneVsf2dZXSfjIqo+nFzWPuW8dmvPLznaTAkA3ylRj9XhqLfqSi/m6iw9s22mDIFu8E 5RikblanLeOzZIJwB+e+N2doGH94AmzjhdWQEKq+yq3SagUAVjf3FNVsgC+xEitisE0k HuzwdNTN5CpjAHmG5Mtk7cdqX7sGxQMTfgmMIKshUjMhna4hJXd/DwL/WSWbDpmNjIdp jkDA== X-Gm-Message-State: AOAM533iAhegk6GmmytEjj4KP5+W9e9LnnwwSd9tRyaQY21UYlaehM2D N3JUy4/oSh44H/e+6eSgka1H+Q== X-Google-Smtp-Source: ABdhPJzaGlRwdGG88vPM8KeLNwNTrmjmNTykbBkHaDRQZiJGTacq7BRde0ct1GoVTHXYxFNftlgRXA== X-Received: by 2002:adf:ea0f:: with SMTP id q15mr5535670wrm.371.1601048432899; Fri, 25 Sep 2020 08:40:32 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 04/15] migration: Silence compiler warning in global_state_store_running() Date: Fri, 25 Sep 2020 16:40:16 +0100 Message-Id: <20200925154027.12672-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200925154027.12672-1-alex.bennee@linaro.org> References: <20200925154027.12672-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x432.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Thomas Huth GCC 9.3.0 on Ubuntu complains: In file included from /usr/include/string.h:495, from /home/travis/build/huth/qemu/include/qemu/osdep.h:87, from ../migration/global_state.c:13: In function =E2=80=98strncpy=E2=80=99, inlined from =E2=80=98global_state_store_running=E2=80=99 at ../migrati= on/global_state.c:47:5: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: =E2=80=98__builtin_strncpy=E2=80=99 specified bound 100 equals destination= size [-Werror=3Dstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__de= st)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~ ... but we apparently really want to do a strncpy here - the size is already checked with the assert() statement right in front of it. To silence the warning, simply replace it with our strpadcpy() function. Suggested-by: Philippe Mathieu-Daud=C3=A9 (two years ag= o) Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200918103430.297167-4-thuth@redhat.com> Signed-off-by: Alex Benn=C3=A9e --- migration/global_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/global_state.c b/migration/global_state.c index 25311479a4bd..a33947ca32b5 100644 --- a/migration/global_state.c +++ b/migration/global_state.c @@ -44,8 +44,8 @@ void global_state_store_running(void) { const char *state =3D RunState_str(RUN_STATE_RUNNING); assert(strlen(state) < sizeof(global_state.runstate)); - strncpy((char *)global_state.runstate, - state, sizeof(global_state.runstate)); + strpadcpy((char *)global_state.runstate, sizeof(global_state.runstate), + state, '\0'); } =20 bool global_state_received(void) --=20 2.20.1