From nobody Mon Feb 9 08:56:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612183387; cv=none; d=zohomail.com; s=zohoarc; b=IijpW++EnTuXsBFWCXOQmBFDaPCHMtTObX8r+w7/Z6pkXt7WlBnlVkmGBKEDmkGRfCoEBh49ZTChvoSNtG1PKD6MJeeLYmHh5bc3scAOTsTor25eGjnTGkbqCs0FrF0GkzfZ20EK8CKkA8xtZmz28EVwiOLxQwWapJKT9ww+bfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612183387; 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=ra7lWdSwwmvPgFlTHE+dMfE2AP6sF8iVaFE6kNYXxnM=; b=IEcYyPrIgF9odSauaLtFwl2qwIajEoXCAEq2UEViAPNLnm4obDiqhgRyZh4OP4FpkueKbN+MYaou0nyQok8wZUUBNO1QESuWSO4RgqI/jSzt+mtWr6atDH4LX2SmEpFdAV8+vD03cvyfXchWeni4/Gr02I3/DPrmcK/NPl/lU5M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612183387651511.19534228346436; Mon, 1 Feb 2021 04:43:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-cF_iDvGwOpil9tMMscA7og-1; Mon, 01 Feb 2021 07:42:43 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 96C94803F43; Mon, 1 Feb 2021 12:42:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6ECA650AC6; Mon, 1 Feb 2021 12:42:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 01EA05003E; Mon, 1 Feb 2021 12:42:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 111CgNtN014740 for ; Mon, 1 Feb 2021 07:42:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8486F5D756; Mon, 1 Feb 2021 12:42:23 +0000 (UTC) Received: from work.redhat.com (ovpn-113-167.ams2.redhat.com [10.36.113.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9711462461; Mon, 1 Feb 2021 12:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612183385; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ra7lWdSwwmvPgFlTHE+dMfE2AP6sF8iVaFE6kNYXxnM=; b=RSmjjLx7KbldOvU3+pfqUqj4xsZc6gBpv2HgLJtk0w1Mgq1eCXSWS+RnD8VJbtt75OFgB1 vRdwhLJ4UdD0HhzVNT6gHHVHE0A8N0/MSmHfw9GwaJNEHS0vIvECLOckUx2Wwr2iHecDKR SgJnqPXmxo9uMPMWJN+nPNl81g8H8V0= X-MC-Unique: cF_iDvGwOpil9tMMscA7og-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 09/10] vircryptotest: Directly assign string to avoid memcpy Date: Mon, 1 Feb 2021 13:42:06 +0100 Message-Id: <20210201124207.148709-10-twiederh@redhat.com> In-Reply-To: <20210201124207.148709-1-twiederh@redhat.com> References: <20210201124207.148709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Found by clang-tidy's "bugprone-not-null-terminated-result" check. clang-tidy's finding is a false positive in this case, as the memset call guarantees null termination. The assignment can be simplified though, and this happens to silence the warning. Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/vircryptotest.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/vircryptotest.c b/tests/vircryptotest.c index 90140077cf..2c3d4bfe75 100644 --- a/tests/vircryptotest.c +++ b/tests/vircryptotest.c @@ -122,7 +122,7 @@ static int mymain(void) { int ret =3D 0; - uint8_t secretdata[8]; + uint8_t secretdata[8] =3D "letmein"; uint8_t expected_ciphertext[16] =3D {0x48, 0x8e, 0x9, 0xb9, 0x6a, 0xa6, 0x24, 0x5f, 0x1b, 0x8c, 0x3f, 0x48, @@ -166,9 +166,6 @@ mymain(void) ret =3D -1; \ } while (0) =20 - memset(&secretdata, 0, 8); - memcpy(&secretdata, "letmein", 7); - VIR_CRYPTO_ENCRYPT(VIR_CRYPTO_CIPHER_AES256CBC, "aes265cbc", secretdata, 7, expected_ciphertext, 16); =20 --=20 2.26.2