From patchwork Sun Nov 22 13:10:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 330431 Delivered-To: patch@linaro.org Received: by 2002:a92:ae0b:0:0:0:0:0 with SMTP id s11csp1304095ilh; Sun, 22 Nov 2020 05:10:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8ZI2lRF70d5RFHLvtrhc3lKqyrpCPqk/rG2YEFRBCb11P1XkqHME8/M4B0fciODOTzBJL X-Received: by 2002:aa7:d28d:: with SMTP id w13mr24470585edq.15.1606050642648; Sun, 22 Nov 2020 05:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606050642; cv=none; d=google.com; s=arc-20160816; b=W4p3MGapT/npxGUsPO/lPo2tNKbEWzS4+QWZXlYpdrYyMdXEFxhgm59KWKbg8IpeUS 3O0+or+i8NVFgh6Zp3nAhXNJUOuX6LJSh/VWe5SkWznqtOHE+bZedrK2iX+W7U/KpP/3 LO5SSNdv88Eea+PO41zPA92x+frbCfQw4cXg0UCzZJJ5XPhmnW9erZAVDbUY0WMRxp0J jc9a4JmLd8wtq7GcAwR5QoC8XfEj7LOzmQoNsfkBrDW0dB43qnk62g04P0Yopom2GJ0L nAg4uVloo9LSTXJQy9kJzO2mBw4ftqVyhUULHbaMBw5bindWLwLyoxug1oPozUbjHCEE ldhA== 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:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=VxNA0PnINQFevFbCVOUpLj6zENN9ONO27f4iBklklBI=; b=xkzvSHo/EsEyf9Y1d6arnLsJdttw7a8zXaHVKFMNq25uHawYv+ME9LP/mh2jXB5oxk jOnkojKQZElksuGG0anPGr6tURKFd+IyDV4RppXIJMbuKcusRY+Jd8j94EzKFNrqkHAr +AUXi/QzR2u6WIVvGqGXBRTlYl6d1tDb/xIO5P6AHsWxu+2DRqflAdqGIBms0aBxQGvc AtGovKdVQXru2iNV3RNMcPGOYhk+XJmmvINhfkaJFl2qN/h70mjstvOG2eYEfy5DxuBd lWGZpE2kb5bqLty370Ls80jZ0XGNZO1lW8pHSgg2fpPaVGJARuhgI0eaafV0TVhUBV72 2OEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iIWC/umF"; 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 ot10si5239311ejb.244.2020.11.22.05.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2020 05:10:42 -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="iIWC/umF"; 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 E981C82564; Sun, 22 Nov 2020 14:10:39 +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="iIWC/umF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 604B682569; Sun, 22 Nov 2020 14:10:33 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (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 7E082821A4 for ; Sun, 22 Nov 2020 14:10:30 +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=ilias.apalodimas@linaro.org Received: by mail-wm1-x342.google.com with SMTP id s13so14746049wmh.4 for ; Sun, 22 Nov 2020 05:10:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VxNA0PnINQFevFbCVOUpLj6zENN9ONO27f4iBklklBI=; b=iIWC/umFyISB8U1LxiqjKxCVY6n6QhzbHXubTgO9V+O96Oht7DYQuWkW//vcYcT7Ed pU4EjKg8Xk7xMFfmu4XWw5hObymmZNCgBKN7MWl4qrBgAq0hh2YmAqZEIRHwmxxI27Ry 4NwdOLm6hy/DvjrdwFegrB03bsPwjHaH1dyJUManjCVTo4XRUIH0Ug1+gXmu0ECc4OWh Ru+iTitgs8n7S6bLeYyWLazaAtvd8CN3ImBIoX0c7oFzv5FtndjcKuXQO0VEF/rMzexz wI2jfl9WohXXkAkyT3PeKy41bKayqafA5NJ0NF441CZm/ln+/0D6sVokMk8kYvloP6I9 E4/g== 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:mime-version :content-transfer-encoding; bh=VxNA0PnINQFevFbCVOUpLj6zENN9ONO27f4iBklklBI=; b=ANhUKXF3y/QTm+6vO2FQcBnswmb6ikC6xfFp1DaF4FQ0w6D8vW92Yx7cXombWZmHkx wmiucy4IcPXDFPKdiDb8TKEs2iUbbljl1+VsC7wQHqk4k44A8UGJh4Vsf83KqHeDQ7Of GFWxkDgJIPmQQhfDpq1AHH3LQSb+glpl/4Xfhsov+KSDtVOBYBjy9EAdgrHyaMHMS/7j tL8FKTs0l/6Pc4Efl59jATOpIEgR40Mfa2m07yn2WsjSDkZHSwC3En9B6ja3+shQE2+9 kZYkEE0NNphMxHMQcgSAUfq84UoAdOf3pe/d72PeYUxUxNmR4fxQO1x/mYk8CUSdZO5Q aLJg== X-Gm-Message-State: AOAM532RWH4uM+2WLczvZdpi2DLBJWMddDpn6b6HsKnzMvtxrjWCLegj afbKgoioDEEj2altaXeMLkjyxg== X-Received: by 2002:a7b:c05a:: with SMTP id u26mr20019476wmc.159.1606050630126; Sun, 22 Nov 2020 05:10:30 -0800 (PST) Received: from apalos.home ([2a02:587:4641:1e88:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id f2sm13693281wre.63.2020.11.22.05.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2020 05:10:29 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: Ilias Apalodimas , Alexander Graf , u-boot@lists.denx.de Subject: [PATCH] charset: make u16_strnlen accessible at runtime Date: Sun, 22 Nov 2020 15:10:26 +0200 Message-Id: <20201122131027.1017975-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean commit 1fabfeef506c ("efi_loader: parameter check in GetNextVariableName()") introduces a check using u16_strnlen(). This code is used on EFI runtime variables as well, so unless we mark it as runtime, the kernel will crash trying to access it. Fixes: 1fabfeef506c ("efi_loader: parameter check in GetNextVariableName()") Signed-off-by: Ilias Apalodimas --- lib/charset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.29.2 Reviewed-by: Heinrich Schuchardt diff --git a/lib/charset.c b/lib/charset.c index 5686d6fb59ce..2177014ee1c5 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -8,6 +8,7 @@ #include #include #include +#include #include static struct capitalization_table capitalization_table[] = @@ -372,7 +373,7 @@ size_t u16_strlen(const void *in) return ret; } -size_t u16_strnlen(const u16 *in, size_t count) +size_t __efi_runtime u16_strnlen(const u16 *in, size_t count) { size_t i; for (i = 0; count-- && in[i]; i++);