From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 2DEAD34389C; Thu, 28 May 2026 20:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780001586; cv=none; b=cQS+yecAV+rI9e/2zwavv2pZN58cKeb34S6FFOwvyO0VIBpHv4AUMQWlqCLgHKBqdQ/X7l8us1jPcIra8NAZYp+XAz3NOqM5zWirMgDqpj/twWanPQFNztSQfH/FdrG3k8WE4T2zLCQ3ErojTHFWNIOh/4Qi7GDVhdd3dmIKZw0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780001586; c=relaxed/simple; bh=rCt4/2rFZjwMAkp6Ntqv7wuSJwbDJlZXFR9nIFDIyB4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oT/L1huNUwRJxksduJrgpX19ecGAoR04cEQ7+olNB9pXR3QNFJD6hjclypBnA7NF4Hl4qQYetgKhCgPgcBsYIPPvxiXwIc+meFPAd6RqYuXI1SZnjyJYTcJj90NijjRCwXtZ0pscA8xxvW4rKBtzccD9PB7XqJzeINumqQu/Z9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xaq0/Jz2; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xaq0/Jz2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 830971F000E9; Thu, 28 May 2026 20:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780001585; bh=OigRmVLoBinCZY+gqxZpDiYe1Mm6yaPvKaSey6ZEHTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xaq0/Jz2zQ4iJ+qvzgG/JGET6/hJAjKW9eOg+GE+5A3n7yLUynFPfUnIi/Tpe5XX0 Pp25tDz3pNkbu9f21+0W68PL6dUAGU0cKGqdOv1r1+caMF2FPImVybrkTzOmNwdNsX IOEKKDllhcP0vqKZ0r7dBIBvRIReJnC+b5tsHOlg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andy Shevchenko , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.6 179/186] gpiolib: cdev: use !mem_is_zero() instead of memchr_inv(s, 0, n) Date: Thu, 28 May 2026 21:50:59 +0200 Message-ID: <20260528194933.822502258@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194928.941004471@linuxfoundation.org> References: <20260528194928.941004471@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andy Shevchenko [ Upstream commit e106b1dd38e723ec2bb2bf57ea9b2aff464b9423 ] Use the mem_is_zero() helper where possible. Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20241110201706.16614-1-andy.shevchenko@gmail.com Signed-off-by: Bartosz Golaszewski Stable-dep-of: 3e6ccd790ed6 ("gpio: cdev: check if uAPI v2 config attributes are correctly zeroed") Signed-off-by: Sasha Levin --- drivers/gpio/gpiolib-cdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 545998e9f6ad2..f9a88b239301e 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -25,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1381,7 +1381,7 @@ static int gpio_v2_line_config_validate(struct gpio_v2_line_config *lc, if (lc->num_attrs > GPIO_V2_LINE_NUM_ATTRS_MAX) return -EINVAL; - if (memchr_inv(lc->padding, 0, sizeof(lc->padding))) + if (!mem_is_zero(lc->padding, sizeof(lc->padding))) return -EINVAL; for (i = 0; i < num_lines; i++) { @@ -1825,7 +1825,7 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip) if ((ulr.num_lines == 0) || (ulr.num_lines > GPIO_V2_LINES_MAX)) return -EINVAL; - if (memchr_inv(ulr.padding, 0, sizeof(ulr.padding))) + if (!mem_is_zero(ulr.padding, sizeof(ulr.padding))) return -EINVAL; lc = &ulr.config; @@ -2619,7 +2619,7 @@ static int lineinfo_get(struct gpio_chardev_data *cdev, void __user *ip, if (copy_from_user(&lineinfo, ip, sizeof(lineinfo))) return -EFAULT; - if (memchr_inv(lineinfo.padding, 0, sizeof(lineinfo.padding))) + if (!mem_is_zero(lineinfo.padding, sizeof(lineinfo.padding))) return -EINVAL; desc = gpiochip_get_desc(cdev->gdev->chip, lineinfo.offset); -- 2.53.0