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 X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF4CAC43381 for ; Tue, 2 Apr 2019 06:51:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C78120857 for ; Tue, 2 Apr 2019 06:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554187903; bh=te+4J1pbpxN2CcwEpvvvdOgldEws8Qu5bOqeS4DRfh4=; h=Subject:To:From:Date:List-ID:From; b=ass7iHsd3NveDtzUND0bWl/FsLjvH7E3B2BPeDhF/NkXHn1/s6E1bD7O/9BFmd2Oo LM6eS2YLc2rYu+wF+c6hcojArJcTo9N/r9sAQSCP6qBMzmdWcZ39w3JzqiFSUkjwxW yD3WN6mnXMQuqRldtLGH80KZk47Ig03dPWREP+DE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726468AbfDBGvn (ORCPT ); Tue, 2 Apr 2019 02:51:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:44698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbfDBGvn (ORCPT ); Tue, 2 Apr 2019 02:51:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D3CF720833; Tue, 2 Apr 2019 06:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554187902; bh=te+4J1pbpxN2CcwEpvvvdOgldEws8Qu5bOqeS4DRfh4=; h=Subject:To:From:Date:From; b=CuDxyMytK2h3FmbXwXdh1vX2AhwVAptQbFLmqqO8PuIsfSNcOXZvo38ULOkOr/+t2 mlQMKFJ9zfPNhsQCcIxWdmLWDVKIV7QLVEP13a+bHfmn9YXjNQXk0z9nYfgohW3cQb T14d46j+s3ePjuj9DzUk1QG9OmmZAPLfnQpX9lNY= Subject: patch "iio: Fix scan mask selection" added to staging-linus To: lars@metafoo.de, Jonathan.Cameron@huawei.com, Stable@vger.kernel.org, alexandru.ardelean@analog.com From: Date: Tue, 02 Apr 2019 08:51:35 +0200 Message-ID: <15541878958242@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled iio: Fix scan mask selection to my staging git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git in the staging-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 20ea39ef9f2f911bd01c69519e7d69cfec79fde3 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 20 Feb 2019 17:11:32 +0200 Subject: iio: Fix scan mask selection The trialmask is expected to have all bits set to 0 after allocation. Currently kmalloc_array() is used which does not zero the memory and so random bits are set. This results in random channels being enabled when they shouldn't. Replace kmalloc_array() with kcalloc() which has the same interface but zeros the memory. Note the fix is actually required earlier than the below fixes tag, but will require a manual backport due to move from kmalloc to kmalloc_array. Signed-off-by: Lars-Peter Clausen Signed-off-by: Alexandru Ardelean Fixes commit 057ac1acdfc4 ("iio: Use kmalloc_array() in iio_scan_mask_set()"). Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-buffer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index cd5bfe39591b..dadd921a4a30 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -320,9 +320,8 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev, const unsigned long *mask; unsigned long *trialmask; - trialmask = kmalloc_array(BITS_TO_LONGS(indio_dev->masklength), - sizeof(*trialmask), - GFP_KERNEL); + trialmask = kcalloc(BITS_TO_LONGS(indio_dev->masklength), + sizeof(*trialmask), GFP_KERNEL); if (trialmask == NULL) return -ENOMEM; if (!indio_dev->masklength) { -- 2.21.0