Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp321940rda; Sat, 21 Oct 2023 09:03:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgsh0gDhpK/zQumx//J+uDewhep0516QQELR8Ee8FusCN+LVj6tDv6YyFOZxgZrwH79REd X-Received: by 2002:a05:6e02:2189:b0:357:6bd2:b2ad with SMTP id j9-20020a056e02218900b003576bd2b2admr6915748ila.22.1697904208251; Sat, 21 Oct 2023 09:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697904208; cv=none; d=google.com; s=arc-20160816; b=zntPimq1ZpGPg1JRDNBW9qmI128tfmF19wCXe9neJBvWs4D4z36OBuce8yvnlZiXGG A/zYY3JnqbCL4CwUpGqyPFZJSwn/tj5uO0NkPLN2hbKzhVAUqjzmPevYuVNyR/R8tfFG 7cZ9iA8P3v7ntBegT8ae0HYSxxQPoJHrrzOm8uvwtejQhfIOwkHb6if/oGv0ErNbvtf7 Dt7xTAPfyfQ+bvABkISbdVgrrf3Dqx4d8WLeyC6pJueLLjFyj8uydL0Ncj6RYD2Qni/9 npUQXcsIrUmVEhn+Nsou75kEd2gpeCXKIjE7FTzMJ9f/v7HUB5TD+cai/fDTO9ApJJEA /CxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=yENL9JqeGB/W0WlC7U8msTzsOxSGZPZmnQurVbpgogo=; fh=aKgSsLsnbw4gR8XRK6tRBix8a7+wMwXmoE/ZK0Z3p+Q=; b=UtbTBZTcnRzMxeL8Z3ojYZZk38V4GmT1FNpoN3BxZUQKJl7jyY0ZyaRVlCst8Wdtul 8UQQZxE5xX18f0X8mw/Vc1i5BQxVAdFY53MhKNcw6ZGIIm/8ygLC/rhsTWEFuZ3YxwuQ 6rqehmKOFAkXwA7Klvm/rCKaDJrxeuwULWGHmjeb+sullOzDCQ4IIuTyxcLl55Hqn7tC UWPxOqYuiqCcFBDLh/pWQllGXFhLB84V90Bo83sKa14eo1m/N+L69sqlQISz61/ZOqlI O+DWbA+/UjyP4F3AoffQpsfoL/uR6fImjDatSl5+Z//nSjM/QVMVFa+VpaeDgH0IT7UB FQOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KNciIUxg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 201-20020a6300d2000000b0055fd1bfb109si3670386pga.679.2023.10.21.09.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 09:03:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KNciIUxg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 42C3180417CC; Sat, 21 Oct 2023 09:03:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231667AbjJUQDX (ORCPT + 99 others); Sat, 21 Oct 2023 12:03:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231372AbjJUQDW (ORCPT ); Sat, 21 Oct 2023 12:03:22 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4A391A4; Sat, 21 Oct 2023 09:03:19 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-507c5249d55so2594233e87.3; Sat, 21 Oct 2023 09:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697904198; x=1698508998; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=yENL9JqeGB/W0WlC7U8msTzsOxSGZPZmnQurVbpgogo=; b=KNciIUxg25RKKJsMrBm6/TwVZ/Fh+RGZV+YLj0/XPUfcb6utLF8wKp2Rh3K7oHhUnZ 7sEYUldv0r3k8oSwehXhPtOp0rBvsIT7QpbxAMOExgkKBiG2ePPDZYGzzS+BEpKuGFXt AXb1gO38dogIq2d9oRunWLvCIewkfCMGCkGM6ilsNLrQ4g+t0rRQIuagzXg3pEgM/a9R Krt0EYXcb55LXkCW0uOs2PnvEi44mSeXEhNJ8YsK47o9pVbpNhb7+70hNiYxI7eKTG7x VN1emn4Qi2vTdmpm+Yr1rYBul5d3NnT+i0fxizGMC3R7gKZ08TlKHjkq4tDFrYTWz3gg oX+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697904198; x=1698508998; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yENL9JqeGB/W0WlC7U8msTzsOxSGZPZmnQurVbpgogo=; b=Y68Locg8f1zhwokfGXtZO6Z8x4n9vpOtm2AdrHdYmW4MmDUFrFI+sVqdqIPG92zd+3 vFLe7vJX2zC7iPVPYj0+yBeRTiCXxfi8EEKgxmJAgBcFzUEKQd9nXPh4OKMbHkk7N2Gz dicK6D+qi8dK1AqUQ1pmIkFmuBG7BRHN/jxHUEAlnrGzxnOr8DaBZYndDKMo6jWwb2c1 +K3wI5UtSagXYOKzxVZCKVNWQaovfmQLuxFlLRShGEABsKHanas69y4IXHUIo4iQNE+y sOJIb8zqTICgeDvEGXt4jWgSyoXeVgak/xGAh2UdXIivo+bvnYAkzretAM8frLcI3GBL uCNA== X-Gm-Message-State: AOJu0YzdD6SMGzD2NUILWj4DhrK4fQv5gtX/4h/5STuBIVX2vCieja12 1n/z6HuSkL/v6k9OXaS3xkRFDSrDNZKM6A== X-Received: by 2002:ac2:58e2:0:b0:4fe:db6:cb41 with SMTP id v2-20020ac258e2000000b004fe0db6cb41mr2941277lfo.39.1697904197333; Sat, 21 Oct 2023 09:03:17 -0700 (PDT) Received: from ?IPV6:2001:14ba:16f8:1500::7? (dc78bmyyyyyyyyyyyyydt-3.rev.dnainternet.fi. [2001:14ba:16f8:1500::7]) by smtp.gmail.com with ESMTPSA id h2-20020ac25962000000b005079db81105sm912538lfp.116.2023.10.21.09.03.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Oct 2023 09:03:16 -0700 (PDT) Message-ID: Date: Sat, 21 Oct 2023 19:03:15 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 0/2] Sanity-check available_scan_masks array Content-Language: en-US, en-GB To: Jonathan Cameron Cc: Matti Vaittinen , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231021165535.34dcb94b@jic23-huawei> From: Matti Vaittinen In-Reply-To: <20231021165535.34dcb94b@jic23-huawei> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 21 Oct 2023 09:03:27 -0700 (PDT) On 10/21/23 18:55, Jonathan Cameron wrote: > On Mon, 16 Oct 2023 14:04:11 +0300 > Matti Vaittinen wrote: > >> Sanity-check available_scan_masks array >> >> The available_scan_masks is an array of bitmasks representing the >> channels which can be simultaneously(*) scanned by a driver from the >> device. Following special characteristics apply: >> >> - When IIO is scanning through the array it will use the first mask >> which can be used to scan all enabled channels. This means drivers >> should order the array in the order of the preference. This does also >> mean that a mask which is a subset of a mask located earler in array >> will never be used because the earlier one will be picked by the core. >> - Masks wider than size of long are supported only to some extent. The >> code scanning through the array will interpret the first mask with >> first long zeroed as end-of-array terminator. Changing this behaviour >> would make mask-arrays for multi-long masks to be terminated by more >> than one zero long. Failure to do so would result kernel to read >> beyond the array generating a potentially hazardous bug. >> >> Add a sanity-check to IIO-device registration emitting a warning if >> available_scan_mask array is misordered or if mask width is larger than >> a long while available_scan_mask-array is populated. Currently there >> should be no in-tree drivers with available_scan_mask populated and mask >> wider than a long. >> >> Revision history: >> v1 => v2: >> - Add patch 2/2 documenting why iio_scan_mask_match() checks only >> a long worth of bits while searching for the end of the >> available_scan_mask-array. >> - Styling of patch 1/2 as per comments from Jonathan >> v1 and related discussion here: >> https://lore.kernel.org/lkml/ZRvjuZaQWdZw1U1I@dc78bmyyyyyyyyyyyyydt-3.rev.dnainternet.fi/ >> >> Matti Vaittinen (2): >> iio: sanity check available_scan_masks array >> iio: buffer: document known issue >> >> drivers/iio/industrialio-buffer.c | 16 ++++++++ >> drivers/iio/industrialio-core.c | 63 +++++++++++++++++++++++++++++++ >> 2 files changed, 79 insertions(+) >> > > Hi Matti, > > Just a quick note to say this looks fine to me, but I don't want to queue it up > just yet given proximity to merge window etc. Makes perfect sense to me. > I'll aim to pick it up early > in next cycle. Give me a poke if I still haven't by rc3 or so. Ouch... My memory gets worse year by year - well, I'll try to remember :) Yours, -- Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~