From patchwork Mon Nov 28 12:45:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 628984 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2912827pvb; Mon, 28 Nov 2022 04:45:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ODWkfKUERQxI9XvXILcNVJk7b3b5bz0RE1BWUlpcsXor7tJJInEranRgOWu2qaXXClzKk X-Received: by 2002:a05:6e02:544:b0:300:87d8:e317 with SMTP id i4-20020a056e02054400b0030087d8e317mr16032296ils.82.1669639542560; Mon, 28 Nov 2022 04:45:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669639542; cv=none; d=google.com; s=arc-20160816; b=OZKN2ZSnzgixeGPMBK7q9yAGZvdRUWjPIoLwcAUYTKeUoPX0NhAj+2uvTRUhm8UkQD hdYW/p3pGut+liB5+qjzGJ9bzhlKhkF8DWQzpHizWJGNkyiz631K/cPQZoeMRcCc1LRz yguyrCM0dgBqWVsMEw3tV4o0FjE5LJw125CnoO7rpzXDn+7lhpopOcGYp2ixtMVP9bv9 wZNegVWKXa501md8GXwezMBdwQhHFTwc8LPTLs7x+XXbIkrDi5yR1lIs49GehsksKZ5D k2IA/Kql8vAop/8hEtB7o5nNRsUXqwSe/LbpL1naKxCXpeP9ItzxcLLiVqD4GekfBO0c psIw== 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=AHjccI3gQMW6OnxtDlKme/V2gbo3JBwbxCWLCHWyYow=; b=MgvllgjCKkVlAyypuQam+k62L1ZmsBQl7lDQbOCA3/dgMsbrJNnvj0K7Wywg/RCIHg E1ZoAQ4aYx4iQe7EBGKRL9xHXpiDiABhDMDdsgPSng8zyAKYWl+Ng2npSpMXZW5iMtM3 3z1+KlClCAbU3lZkjUXdXY5665W1nycmbvdyNSZwRjT3eYsgJANIsiP9T6u/D6uPUn1P BBcsoBjIMhziVZ8m8O051oVWgLJfaHFNuSWUNxaBnaeUVcvLMTAdIRyCvZOdhudKgEXm 81Hz4WmJfGIyUqIjO/lc/lEwsifdiuhvw7gjzzEn4fpqheFtFlh8iQyEPPH0ApB3R/tW XWxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=msF9XJUC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 5-20020a056e0216c500b00302ab3d546asi9534746ilx.152.2022.11.28.04.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 04:45:42 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=msF9XJUC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 45FE38527A; Mon, 28 Nov 2022 13:45:26 +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="msF9XJUC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1942F85231; Mon, 28 Nov 2022 13:45:11 +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-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) (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 372F685231 for ; Mon, 28 Nov 2022 13:45:08 +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-x102a.google.com with SMTP id v3-20020a17090ac90300b00218441ac0f6so12421593pjt.0 for ; Mon, 28 Nov 2022 04:45:08 -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=AHjccI3gQMW6OnxtDlKme/V2gbo3JBwbxCWLCHWyYow=; b=msF9XJUCoiFsGuWI5fGJ01meJ0yku94N6rsK7ePbis77CsJht63tN6IRD0Jw/n1P2S rD4BAa1UrjSqVuThNDogRFDYmxMpwytLGW3FK6JbtzcXBkX4AoBatOdIGfjVRYmdU4Ry Blp+NibpJv73rQXGAphMT2mUWTy6LCX8gAfMFKxYwL5U5+lmf8T1m5q+1V/r2LswW3fB FO6uzlQX5FKV5J8+0rIB+3KDvrzlMByutYvledUYQ0NXCZz4lU+ApfTmD+6O5Cfldir+ en1+yp4UYDTAuhWAYyPeVU3djrLLo8ftAFVptM8VXZ3/u4z25UloQS0xu2V2ZZdBncae kf4A== 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=AHjccI3gQMW6OnxtDlKme/V2gbo3JBwbxCWLCHWyYow=; b=yPTPQWpvTDwFeb9YhFJcrvkZNj6VNDq+nflk0xj6xwb69oK9iYm+mavs2awgmQPIQI 2rhyXIGrqV0jwhE0elQl7qJzbxTT+0BaaQHj/+htB0WYKwSwND2WLw+IsdILv7UoXGHf oRMm2bFgpvm6OEiZ+AYo1t/mvcN1Y0/a2u3CtjDXBTA/HTZx+lnaVk7csUVXhSTqn4jF z2U6lcj4I7MOaSYXC7giraFVnFma6Iv5/C5fPELde8CgU6Z1O4UlIFqZ7YwvdkaLIomJ m7hzhtG2Gq7fsP4OSfOW4FOqmq0/xYgwqfH1Kt5QocDQQYlm/AOTLY+MFvD/48elJ0Mk wCDw== X-Gm-Message-State: ANoB5pmylUCXUZwr5eYGLrI220ZcACEVErwHuRYl0vB0XM28szkYCWp2 1CnjylgSB9Rheo6Vhybu1zeAjTZZAL+b9g== X-Received: by 2002:a17:90b:1650:b0:218:6ad0:52c5 with SMTP id il16-20020a17090b165000b002186ad052c5mr27115575pjb.44.1669639506203; Mon, 28 Nov 2022 04:45:06 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id w27-20020a63475b000000b0047681fa88d1sm3925303pgk.53.2022.11.28.04.45.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 04:45:05 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Jerome Forissier , Masahisa Kojima Subject: [PATCH v2 2/5] eficonfig: use u16_strsize() to get u16 string buffer size Date: Mon, 28 Nov 2022 21:45:06 +0900 Message-Id: <20221128124509.6939-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221128124509.6939-1-masahisa.kojima@linaro.org> References: <20221128124509.6939-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 Reviewed-by: Ilias Apalodimas --- No update since v1. cmd/eficonfig.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 5529edc85e..88d507d04c 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;