From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2982447ECF4 for ; Fri, 15 May 2026 11:46:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778845608; cv=none; b=PNuHaFadZEuSdvwQRjMM1EJlzju5lAzRczmhyimRiOoYKCmqEZRdait8mnLt96VENTJFGx16jUBgwIzLl4+8aZhmxXxomTRwdm4wjbkxgE+WR9X9JwVXsz0IaraHAgnRI8/cQMtokheykCPBg2iNcxmf6POoSK7TnRUfdK8eO8I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778845608; c=relaxed/simple; bh=3C8/dzj0MkqyH/knNgOZqyJveaodvFkeUZ36iPYKyjk=; h=Subject:To:From:Date:Message-ID:MIME-Version:Content-Type; b=VihpYAk8rWkkVnauSKEGKaZXCgR+CXjgQcnmFOo4kPumF2QWljhTVadXPI7UEOwPzkjbvbEGrd1dus4ssIqXTiYd+tIRYjCP4rmC/YiUm51uoi0uLteLmUz226D+89TVT6704yL0WnTFZ+2TMv5lb2M5ze2d4y4TL/CC9iRU5Uo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=goT81iOM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="goT81iOM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB388C2BCB8; Fri, 15 May 2026 11:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778845608; bh=3C8/dzj0MkqyH/knNgOZqyJveaodvFkeUZ36iPYKyjk=; h=Subject:To:From:Date:From; b=goT81iOMA4mKhosshANYEh0QIoz3ZFuHvMxUbDH96yIOGJFllNlJ++l+x4xiycKnR OcQW0SIdAyUL+NqJZY4koXbM3y+F71dnfFKo0MqIscT8aOkeKh4la7RdrxI+w+diOt Sjymv7ER5Uxkn5P+D1++LSZKd852UyqrY18ZfGN0= Subject: patch "iio: dac: ad5686: fix input raw value check" added to char-misc-linus To: rodrigo.alencar@analog.com,Stable@vger.kernel.org,andriy.shevchenko@intel.com,jic23@kernel.org From: Date: Fri, 15 May 2026 13:46:00 +0200 Message-ID: <2026051500-mortify-sixteen-034f@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit This is a note to let you know that I've just added the patch titled iio: dac: ad5686: fix input raw value check to my char-misc git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git in the char-misc-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From d01220ee5e43c65a206df827b39bf5cf5f7b9dce Mon Sep 17 00:00:00 2001 From: Rodrigo Alencar Date: Fri, 1 May 2026 10:14:55 +0100 Subject: iio: dac: ad5686: fix input raw value check Fix range check for input raw value, which is off by one, i.e., for a 10-bit DAC the max valid value is 1023, but 1 << 10 equals 1024, which passes the previous check, allowing an out-of-range write. The issue exists since the ad5686 driver was first introduced. Fixes: c2f37c8dcadc ("iio: dac: New driver for AD5686R, AD5685R, AD5684R Digital to analog converters") Reviewed-by: Andy Shevchenko Signed-off-by: Rodrigo Alencar Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/dac/ad5686.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c index b85d5c5a864b..27878a6318ff 100644 --- a/drivers/iio/dac/ad5686.c +++ b/drivers/iio/dac/ad5686.c @@ -154,7 +154,7 @@ static int ad5686_write_raw(struct iio_dev *indio_dev, switch (mask) { case IIO_CHAN_INFO_RAW: - if (val > (1 << chan->scan_type.realbits) || val < 0) + if (val >= (1 << chan->scan_type.realbits) || val < 0) return -EINVAL; mutex_lock(&st->lock); -- 2.54.0