From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 332BD2F8E8E for ; Wed, 16 Sep 2026 14:47:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789570051; cv=none; b=qAkBmBOztf9USBHjQsaADYoWG/96qEgM6GCKrmrOkftEwwkVFQJQnzN1JN6OS0NFXnm0DJRwGU1Sg4qN7dxdUFBPmQIAG/eEzFFt9DhXh+Z/bMBGQHAfbHPGOLiCsm3O8A8CMdGGSyYdYvO2/xgN5Zt+r/14vCSjSTWtYt0yZVQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789570051; c=relaxed/simple; bh=2xhGhsnM6cFg9XqwguWnmGOLniqfg3yffsSq814n3oY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=N8hgecYWPc1gybv8oPc9mdEyrvOA5tmL9U2hrrZdzYJV8Xu7ULry/rIe0E0KPH19L0j1C60Qg5O49KwyagldLyiZbTRjm6QmxoR6ijfrhk3K+OI8dxYyE8cuLGEyv1TXaTpka8JGNXF2COubKNsPo6mBBPsEuoESU1sQS8wuGKo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=C2TpLZgK; arc=none smtp.client-ip=209.85.128.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="C2TpLZgK" Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-49953abe51fso34901785e9.1 for ; Wed, 16 Sep 2026 07:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1789570047; x=1790174847; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=adQpVVPYDSCv+/CQimrvUBYO3H49guv1JLukjJuQ+Nw=; b=C2TpLZgKvbqrLxGl3GBqP4xjqJWRtdNDpVU6FsPgBOhCcy0ftRcorh66sutaniGFFs ff3kAVI+0FcQSF6by6xZTVW4PVrxg4LUU7P0lNApyzhgvPpC6vYGj4eUFBxfly/NwgOy koLsOqZxNQIqeiC5/PhODkSkwJy777tOZJiL9zxZok98bUSmwsRu+wkdRn2MxOzqYrdt fRGuO8P/rAB9pkNkhl574P95e/h1oPOvmiEbQJm/x5sgZKbUN5WOoIksCpSg84lVA2LS swNsOOvZLwbUHuHUh8YJbqwZTQkLKtU7OmPeC8QHdmyCkuBLQRklpc7LVTbB1koKCgh8 puWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789570047; x=1790174847; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=adQpVVPYDSCv+/CQimrvUBYO3H49guv1JLukjJuQ+Nw=; b=rYcRIv/bws1Q3FRy/aJYXgJXBMVfT7U5OGAtljNX/DHdZehB81QxHuqqYaX2MsSKTd coyNyxhUOeblF5uMIedcF0NEOX5fy/3ikWewHuPdMupjNaCHkPYJDTM6umSuyAfzc7Td 0ak3Af5Flpdxlsk5wsLp+bHqTdUuH4DN5NFETn88JXKaQkYzT2z185MwMlKBKXaCTtgv bIz070oLwu45cnoxVACnVna5LR727Vs3eQN/P1vcm1FsnwyjPJzqD9SHel3ndMLX2zxt Y/Fq25qqLyV3qN6mpP2gBFawb4NIepvZq+cKTSoW6ZrCnHs6LbNJNawEBcg6QHdJqtDZ U2xg== X-Gm-Message-State: AFuF++l2uNaeT8mKDhbjCM9xYn1Ut1sPPMsMQuII3X673dncE3eHToYg y8GLyTDRcGD85BSBTfnKM4e/DEpR+Se4ngFgUwS0JGB1utehyKtT0sXknZIbBVk108Y/5P8BRA= = X-Received: from wmwb6-n1.prod.google.com ([2002:a05:600d:4446:10b0:49e:6be1:415d]) (user=ardb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1f8f:b0:49c:cee2:1697 with SMTP id 5b1f17b1804b1-49eb7322d4fmr34446395e9.16.1789570047100; Wed, 16 Sep 2026 07:47:27 -0700 (PDT) Date: Wed, 16 Sep 2026 16:46:49 +0200 In-Reply-To: <20260916144647.2651379-11-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260916144647.2651379-11-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=873; i=ardb@kernel.org; h=from:subject; bh=YU1ElVLaCeA6lifqtbLFaABcpHCwQcZWRxgO278csYc=; b=owGbwMvMwCVmkMcZplerG8N4Wi2JIWvV6psf7zU3fTJ3kP7pnrSCtW6/kUitm/SL1rUPVDbVy +XXSdzpKGVhEONikBVTZBGY/ffdztMTpWqdZ8nCzGFlAhnCwMUpABPR+Mrwz+Cdr4KHy9zUVRpu vu8vTT1+wvVhfMHvcusCT/mZ978bX2P4X6+7Y4b+MxXun7N/zfOMFN3XvMcubJGCiKjnp7z921d 2MAIA X-Mailer: git-send-email 2.55.0.1032.g73a4cd73de-goog Message-ID: <20260916144647.2651379-12-ardb+git@google.com> Subject: [PATCH v3 1/9] lib/ucs2_string: Drop arbitrary input size limit and associated WARN() From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Vincent Mailhol Content-Type: text/plain; charset="UTF-8" From: Ard Biesheuvel It's not really the job of library code to WARN and potentially bring down the system (with panic_on_warn=1) on a condition that is fairly arbitrary to begin with. So drop the WARN_ON_ONCE() as well as the condition from ucs2_strscpy(). Signed-off-by: Ard Biesheuvel --- lib/ucs2_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ucs2_string.c b/lib/ucs2_string.c index 1f7dd4eb640a..d66fef9c9b81 100644 --- a/lib/ucs2_string.c +++ b/lib/ucs2_string.c @@ -57,7 +57,7 @@ ssize_t ucs2_strscpy(ucs2_char_t *dst, const ucs2_char_t *src, size_t count) * Ensure that we have a valid amount of space. We need to store at * least one NUL-character. */ - if (count == 0 || WARN_ON_ONCE(count > INT_MAX / sizeof(*dst))) + if (count == 0) return -E2BIG; /* -- 2.55.0.1032.g73a4cd73de-goog