Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4064854pxb; Mon, 4 Oct 2021 16:35:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpr7ydzUmYimJ5hWR9FT12ec7AAWDawDMma4V+NR9VwPgzMWx/Nrpe84uz1WK2xHv8pWZ8 X-Received: by 2002:a17:906:c0cd:: with SMTP id bn13mr20834614ejb.251.1633390548734; Mon, 04 Oct 2021 16:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633390548; cv=none; d=google.com; s=arc-20160816; b=iqwNxtnWy46S8N8Hv6L6Y1bMc1u0MjkbxyejziJ/rGJLFo4bDsiQcLvWihR0RLHV52 16f3y6Nr4LoHtc5uslCwKPzxNR0TUHWdfa1WgPsBcJA3eHpdmp0c1xPMAD8ggJIy6m+k 1NMqBcQRjZw0f7JGDqVvU/R+SJtxHhO9ScHEDKY/U8REGLNU4hqBuPff7iYJCVU4FHce kGGXpkvD35oRfhySxH0i0GxfW+TY8sieAe/6mPdVKfIPr94sajp/oyHQ5nA/A3oD5fP6 V0yNfNcbJ+OmsaiYWvTyiVlbYVIQvEZ+3l9wg5Qrz2qD1tWfUe2b4jee8BFPHjqSxXHh UxnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=CNHzGlZwNkxOegLISaJMb+jzsMUeIRACw9GPddWNbsM=; b=tglWKvc4GQgOitOgUK8ittH9oLbHVVP3MGADDoUBEpJYi7yX01bEKKqEzcTxCabzYe dPRM8sX7zfbRycWURysv4t79aMRy83ezCahr18iSJnX1bmEa8ZitqTc9NUarfffUPN2X xnyWs8TqK7kM3sqPtbyU6VuH/Dv9rLf68HsvvqRbwH95jID0RQyLYs+YMGTnJndJQn4T 97LUzYf7G9oAwjnw/ZnFobxWlR4L7cq+ncrBsaYiUw+holq7WsUzNJ9y+saH2tmd1KyM Np5yryu68vckkJobuWeNbDMvoZe6nAIHLxjyWzy8lK80ckidSNrxI5UhTPMjV7iRaro/ rRsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr6si3218472ejc.711.2021.10.04.16.35.25; Mon, 04 Oct 2021 16:35:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238862AbhJDT3f (ORCPT + 99 others); Mon, 4 Oct 2021 15:29:35 -0400 Received: from relay03.th.seeweb.it ([5.144.164.164]:40251 "EHLO relay03.th.seeweb.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235352AbhJDT3e (ORCPT ); Mon, 4 Oct 2021 15:29:34 -0400 Received: from Marijn-Arch-PC.localdomain (94-209-165-62.cable.dynamic.v4.ziggo.nl [94.209.165.62]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r1.th.seeweb.it (Postfix) with ESMTPSA id 126E51F673; Mon, 4 Oct 2021 21:27:43 +0200 (CEST) From: Marijn Suijten To: phone-devel@vger.kernel.org, Andy Gross , Bjorn Andersson , Lee Jones , Daniel Thompson , Jingoo Han Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Jami Kettunen , Pavel Dubrova , Marijn Suijten , Kiran Gunda , Courtney Cavin , Bryan Wu , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 00/10] backlight: qcom-wled: fix and solidify handling of enabled-strings Date: Mon, 4 Oct 2021 21:27:31 +0200 Message-Id: <20211004192741.621870-1-marijn.suijten@somainline.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset fixes WLED's handling of enabled-strings: besides some cleanup it is now actually possible to specify a non-contiguous array of enabled strings (not necessarily starting at zero) and the values from DT are now validated to prevent possible unexpected out-of-bounds register and array element accesses. Off-by-one mistakes in the maximum number of strings, also causing out-of-bounds access, have been addressed as well. Marijn Suijten (10): backlight: qcom-wled: Pass number of elements to read to read_u32_array backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion backlight: qcom-wled: Override num-strings when enabled-strings is set backlight: qcom-wled: Validate enabled string indices in DT backlight: qcom-wled: Fix off-by-one maximum with default num_strings backlight: qcom-wled: Remove unnecessary 4th default string in wled3 backlight: qcom-wled: Provide enabled_strings default for wled 4 and 5 backlight: qcom-wled: Remove unnecessary double whitespace backlight: qcom-wled: Consistently use enabled-strings in set_brightness backlight: qcom-wled: Consider enabled_strings in autodetection drivers/video/backlight/qcom-wled.c | 88 ++++++++++++++++++----------- 1 file changed, 55 insertions(+), 33 deletions(-) -- 2.33.0