Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pXnYp-000639-5c for mharc-grub-devel@gnu.org; Thu, 02 Mar 2023 13:21:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXnYm-00060o-1O for grub-devel@gnu.org; Thu, 02 Mar 2023 13:21:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXnYk-000475-Jl for grub-devel@gnu.org; Thu, 02 Mar 2023 13:21:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677781301; 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=n40bvEMUgXtHLrPnGy5MhTPXm7lxs5OBlIMDCYxJb5A=; b=NQEWDa8I8xn8BuGZFXJMgttdACTyXNxTcfovHHTwzOPj5BZ/qKrgY8qlFZpaIoEjlfVBPP gcD1ByY+i8DWjF2C9sjvY1vCxxGOs2mPSP3KoOrI72WL8Ce3Bw4kZHHqgRRzJ2/ue/u0GV 1faJWJkXWfPNU5+L3+tFVnmtPCr8TDk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-196-iSWw999CMeuU644DqOOK2w-1; Thu, 02 Mar 2023 13:21:38 -0500 X-MC-Unique: iSWw999CMeuU644DqOOK2w-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8EF0C1C08970; Thu, 2 Mar 2023 18:21:38 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id A519A492C3E; Thu, 2 Mar 2023 18:21:37 +0000 (UTC) From: Oliver Steffen To: grub-devel@gnu.org Cc: Daniel Kiper , Gerd Hoffmann , Javier Martinez Canillas , Oliver Steffen Subject: [PATCH v3 07/10] grub-core/kern/efi: Remove redundant null-termination Date: Thu, 2 Mar 2023 19:20:42 +0100 Message-Id: <20230302182045.810724-8-osteffen@redhat.com> In-Reply-To: <20230302182045.810724-1-osteffen@redhat.com> References: <20230302182045.810724-1-osteffen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Received-SPF: pass client-ip=170.10.133.124; envelope-from=osteffen@redhat.com; helo=us-smtp-delivery-124.mimecast.com 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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Mar 2023 18:21:45 -0000 grub_calloc already initializes the buffer with \0, no need to set the null-terminator at the end. Signed-off-by: Oliver Steffen --- grub-core/kern/efi/efi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c index 91aa5d644..008bf2f2e 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -221,7 +221,6 @@ grub_efi_set_variable_with_attributes (const char *var, const grub_guid_t *guid, if (!var16) return grub_errno; len16 = grub_utf8_to_utf16 (var16, len16, (grub_uint8_t *) var, len, NULL); - var16[len16] = 0; r = grub_efi_system_table->runtime_services; @@ -267,7 +266,6 @@ grub_efi_get_variable_with_attributes (const char *var, if (!var16) return GRUB_EFI_OUT_OF_RESOURCES; len16 = grub_utf8_to_utf16 (var16, len16, (grub_uint8_t *) var, len, NULL); - var16[len16] = 0; r = grub_efi_system_table->runtime_services; -- 2.39.2