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: 1404478 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=iIWC/umF; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cf9dN6C9rz9sSf for ; Mon, 23 Nov 2020 00:10:48 +1100 (AEDT) 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-Google-Smtp-Source: ABdhPJyoMa+1+rLEodd3hXW2MQevz3NcRuhN946YBBIOkAQ92bkGln4NrGakFX30jT5voVNJ0/uXRA== 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 Reviewed-by: Heinrich Schuchardt --- lib/charset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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++);