From patchwork Wed Nov 23 07:17:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627918 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2966604pvb; Tue, 22 Nov 2022 23:17:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf7XzdrdHurYaySdesl/Cix3D5R8a1cQ3xKH+H6lRUNd7aI2iRDQTV2aLfXpP6pyEeiLze/g X-Received: by 2002:a05:6e02:1d9e:b0:302:4aef:5792 with SMTP id h30-20020a056e021d9e00b003024aef5792mr4137895ila.202.1669187874982; Tue, 22 Nov 2022 23:17:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669187874; cv=none; d=google.com; s=arc-20160816; b=r3dEbbhKDnKb0xelrqOCe78T6U0tXimDqkkmfKn9CkUDD6OiQGS/OdKOuEDZHz1j3s dGrarlnr5OmvuUKsMpKjwvO7z8RdkZUDjVsnMp3LHuQ516t8nLoZjpEBUWKHlV8JiN52 P+AS2/PIlAnxCnkTffzDoEEq2l4lVHr17cpV+LyV4br7C7b7tYQ5ICH5NdzpJJUdgbAY bVprtDiPUsP9jUQ/vwyHr6YueTW+PymcYL/B/2OaXljzmc8+shA/BmpKwq5oHRPm0EOh dOAzTWq797/FhJfzLpiA+Qz46kS2+/foJCFgMBhCx1QJjb7uZlE+ouFXlGAw3Z0fCFyl TdYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=/BocOUr9JthWTTm0jJZqi/ebdvJ0LXP0/XZL4Rvg0t8=; b=wuRh4ysmf+968kMGR/Zr4KNgmn4p9dIsL6GjlLZ9UbVs2PomCVrDapWBXLXUA3XLlN 7bUKHdgoQ1i16RyR89PFxXV8qqRznlW8yRChLk0uDt5lOK7qwCOsezAPmBlTgawv8Y5g sK5gybzcWxKob5356GOghaq36VVwJK4xQ1i9BnUZAERm+y34mHXJcYA/xDtPPqJc19HD 5yOxnmYvbm5m1laILA5NwfVjihRoJGSwdw76nHGSxaGBNhzsSDf8bLqKH/fiXxo2CXXZ kDWSYIxZFWhJokFao6iw2bldUnX1IAcaefS1f+89OwXwRBgHa06wdCDfPBnSijFWbGx9 uzbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZhO36lPh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id q35-20020a027b23000000b00371bd058965si9193455jac.83.2022.11.22.23.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 23:17:54 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZhO36lPh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F2BDF85411; Wed, 23 Nov 2022 08:17:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ZhO36lPh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A8ABD85568; Wed, 23 Nov 2022 08:17:23 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2FBF48517E for ; Wed, 23 Nov 2022 08:17:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pj1-x1034.google.com with SMTP id a22-20020a17090a6d9600b0021896eb5554so1156170pjk.1 for ; Tue, 22 Nov 2022 23:17:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=/BocOUr9JthWTTm0jJZqi/ebdvJ0LXP0/XZL4Rvg0t8=; b=ZhO36lPhEiDDmd0kL0J/2qMUiPdypZGszvN7vwd8u2AtAAOt9Y38zvKlRJT5SyaOVk alfMcE3Xl8527Fav7iHX0m3gHNAN577zOy59TrK1ldyRL6iwsTAbR2K3wPmUIXZHR2bz W7dJ6SFRpzu8iyN1lkA/Gj1MC6ieDpdpcGO37MbJBEZkHuBTs3F8GDutSfvz6kGJ/DVV Jd+roOBfC+hZsnoVvsFcDUmHgqRCilyFHB63BItUjrrHQhy3IzJXJVXski/TAU4ZAgyd e2ibeAR4ALoa3Y3q8WJ4BHecEYLeJtxUokqs455P7K70HHXN4W9X9TZlhgfsD0KBIEFG srQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/BocOUr9JthWTTm0jJZqi/ebdvJ0LXP0/XZL4Rvg0t8=; b=KmV3x3S2BdmsMxt9+IgLtd9oXZfJe+PuKaDnH8tnEz3/uqkmW/6n5y8pCUqDoIwPQx T/VLX1aOkws1eAa1OcFe8wT8g/jScFvQbzIFL/I4dnUZIMDWM2rEZQdxdPyx+QGoXXOO V1qq9mMzH8Fh2fKwJMcjOhLiYtPF7cENU8pmuWN+a2gBlGLKSi/B+M4Sc3u1aIMXpt4D E5yQhdCbRCvH1XiyjHARfoD0hgvJrlm4xbduXZHqjYxY6adXNfHmd/Efx0p9pj9EXQMW j5L4xzPv6ezreX5zQeG4UWmlk4mgF99cEy3FHYKWQ+9JYTQ5za3fKgF5T6mOuy89ccVI d2zQ== X-Gm-Message-State: ANoB5pm2l09m9mNF8BezqQOnVVQqNO8ZD2kzVYC+6t6Z8Cn/evuDYcpC Y+8vTwdECKf4krdbwWdrFtEo1NJ/moDJdQ== X-Received: by 2002:a17:90b:3c4c:b0:218:a8a1:933a with SMTP id pm12-20020a17090b3c4c00b00218a8a1933amr15427413pjb.14.1669187839189; Tue, 22 Nov 2022 23:17:19 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id n20-20020a170902d0d400b0016d72804664sm5512863pln.205.2022.11.22.23.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 23:17:18 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima Subject: [PATCH 3/3] eficonfig: use u16_strsize() to get u16 string buffer size Date: Wed, 23 Nov 2022 16:17:10 +0900 Message-Id: <20221123071710.28506-4-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221123071710.28506-1-masahisa.kojima@linaro.org> References: <20221123071710.28506-1-masahisa.kojima@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Use u16_strsize() to simplify the u16 string buffer size calculation. Signed-off-by: Masahisa Kojima Reviewed-by: Heinrich Schuchardt --- cmd/eficonfig.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 20b9a29d3a..282b5d2cf2 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -452,8 +452,7 @@ struct efi_device_path *eficonfig_create_device_path(struct efi_device_path *dp_ struct efi_device_path *dp; struct efi_device_path_file_path *fp; - fp_size = sizeof(struct efi_device_path) + - ((u16_strlen(current_path) + 1) * sizeof(u16)); + fp_size = sizeof(struct efi_device_path) + u16_strsize(current_path); buf = calloc(1, fp_size + sizeof(END)); if (!buf) return NULL;