From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CBD51C53219 for ; Mon, 27 Jul 2026 12:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:To:From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eUGVKiwy7jaGyr4QKYdW8ygHwqCtsan2rvkAt4QGNF8=; b=ATgMMf2RvprQPah32Wjjh0t7kO 6k3qPkxZRnFzquG3kWHAPOP97wSIORxZAUJRiRFKgZw63RVW8/Zn7FFeAVfv5LTnOrC640Cae6cI7 EUC5cuzUSFu9zsvqDvqaIK+zApH1LmWQ33bUiG4btihGRVNQTPOGuE78u5CPUSYVhDoQhGZKUnhCT XFXkcNQX18jRyMR9nEzIeny18ChVMhpYzZajxJRwdR1pHEs2PytDa/WdbHTtDXVWskgh6voF+KTSv aHFab4fdV7uOrgbiek2u+w7A+aG75Z2Yn3W/JgGLCFdxUR9zfz2l3NP0SDLn1Ex/SfylZ7QTVb6Hu tXfeC+wQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1woKQi-00000002gAH-2ZlV; Mon, 27 Jul 2026 12:27:36 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1woKQd-00000002g6D-2qNy for linux-arm-kernel@lists.infradead.org; Mon, 27 Jul 2026 12:27:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1785155251; x=1816691251; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HA06NVq1HboUGFnrcw6m52P6ZwSDBODfp3HnmxjuWgQ=; b=a4Bg6EXzSv4dhVTzy57FbcmSm0ub/fZsHGmL8NgdcHpiGk+eBnFeaw2w MouWpVwrNrtpyPIHuECE7LjJAzd0Wvgq7pbmSn2uBBvsoI8+D6D67BaRG H/TLtkF7BPIv5xVbzaJky2AmhArE4uw1lKsQTtWAzruSABogCrNbcqajj d6BEEq0s5yq7eOnrO8sGh9YfSGBESeK9TNF8gWvPIhgwOiMdSeGLsr2JH mI8taNnfW6m7CKkv3vIIfRpZDyF3xuaBz30I2sTL8jZrpq4IgFyeJYb7M l30epLiC0plqZdef+3mBBIb8Gqrdy8WMI1e54MGT/BRrPY6No6A1rX6SY Q==; X-CSE-ConnectionGUID: fntFfp1DSnC0xbr9xq5p5Q== X-CSE-MsgGUID: P0QeA1HhSxmn5fTqaKQdXg== X-IronPort-AV: E=Sophos;i="6.25,188,1779174000"; d="scan'208";a="70709551" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 27 Jul 2026 05:27:29 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Mon, 27 Jul 2026 05:27:28 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Mon, 27 Jul 2026 05:27:19 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 04/16] iio: adc: at91-sama5d2_adc: add condition to validate calibration data Date: Mon, 27 Jul 2026 17:56:21 +0530 Message-ID: <20260727122633.117435-5-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260727122633.117435-1-varshini.rajendran@microchip.com> References: <20260727122633.117435-1-varshini.rajendran@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260727_052731_735275_E322A84B X-CRM114-Status: GOOD ( 10.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add additional condition to validate the calibration data read from the NVMEM cell using the TAG of the packet. Signed-off-by: Varshini Rajendran --- drivers/iio/adc/at91-sama5d2_adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 798e4d60bf69..15dc88f4961b 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -2297,7 +2297,8 @@ static int at91_adc_temp_sensor_init(struct at91_adc_state *st, return dev_err_probe(dev, PTR_ERR(buf), "Failed to read calibration data!\n"); - if (len < layout->min_len * sizeof(*buf)) { + if (len < layout->min_len * sizeof(*buf) || + buf[layout->tag_idx] != AT91_TEMP_CALIB_TAG_ACST) { dev_err(dev, "Invalid calibration data!\n"); return -EINVAL; } -- 2.34.1