Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4172417pxj; Mon, 21 Jun 2021 15:31:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1Joiv4lom0cTkhEBLkfX9iEEqPyxxqSrc0Af2l6L21OrY1+jywGTE73NlvYQsj0af/TJZ X-Received: by 2002:a6b:103:: with SMTP id 3mr262950iob.156.1624314669310; Mon, 21 Jun 2021 15:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624314669; cv=none; d=google.com; s=arc-20160816; b=PUxdm891Vz6lQEPNTYE/Kwet6QMwbHMn3oV0g51owkl5PDiQ/r2xehCihidASfS+MA 2hoGyZj+ZT3nZynShe07hhZRlecN9AD62YRUpE6a9VsUP5rVtcj57SJ/A+kLZuSiDj5O cUp3YtE1QE7Y9HBJwJ6igtxkCsCQHEmFvMlrJqNzkMUXIhmp6ehPlRhT6+j5pjwkXE+T Kol7YEzhOdUFGk2GjFlhVPG651dnTVB8YBLUzEb1imaQssbBx04gGHigACJUfEZekaWj LifoSbBYPUojbsCQV6XeBnQ5zA3UyT5KagHNaokFE4RHGTrZkA8g6hrSWPiyXnX5VGh6 EC6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=w4cpZciMJ+Hr0lMIKj61KeolPWCnI1wrN4jxQEIL8zQ=; b=PuIL7T/FfrH5yTm8m8o9bDMHeLi/03OtB6orW/ZETVaI5p0yNrnL2W5VfhtWcVv6Ve 0jcAG0/hBEJ1jzm9yL89JGsEjDiQN+ByNZTTwkXVzYFaB49ZNy3VzLWmgo3SCXEcHh61 pTXcmC+NDGggE60DepY95O1tpQJ11yJKpH2ZN1TIDaxfDFlSAlxddUPzu5fcn79Xmoml fXDoCOpST69W9S2QXjZxNOi6gXN/yDQByk+8z+lm7Pj1TQJggd8DeYgYtNhehkGGD8Kk gW+0vdNVBiVUKmSp+bJPUUETBNcZztr3GVo/UHdxX8wMytRo5/KmLJCg/hnMzOwBk42t ajdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=lFtIjGfn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r24si19595815iog.39.2021.06.21.15.30.55; Mon, 21 Jun 2021 15:31:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=lFtIjGfn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231488AbhFUWbl (ORCPT + 99 others); Mon, 21 Jun 2021 18:31:41 -0400 Received: from linux.microsoft.com ([13.77.154.182]:44188 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbhFUWbk (ORCPT ); Mon, 21 Jun 2021 18:31:40 -0400 Received: by linux.microsoft.com (Postfix, from userid 1101) id 0703C20B7178; Mon, 21 Jun 2021 15:29:26 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0703C20B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1624314566; bh=w4cpZciMJ+Hr0lMIKj61KeolPWCnI1wrN4jxQEIL8zQ=; h=From:To:Cc:Subject:Date:From; b=lFtIjGfnBPdq8ioVgA7nMwXsUKtbSUiBciabFcGE7rX0JxaVVfGuxemenByPVwiQy j5e4U7B80hVx76tVW7mYj5WpEofKAXFT7t+yjvJ1XmUOBBM+SL50Onu72jBV+ZBOCT StRJ3EaJ8qtzkFsJFQvh3e1EikETOCTEC0SmhUmk= From: Gabriel Knezek To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, bgolaszewski@baylibre.com, linus.walleij@linaro.org, joe.reviewer@hotmail.com Cc: Gabriel Knezek Subject: [PATCH v3] gpiolib: cdev: zero padding during conversion to gpioline_info_changed Date: Mon, 21 Jun 2021 15:28:59 -0700 Message-Id: <1624314539-17396-1-git-send-email-gabeknez@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When userspace requests a GPIO v1 line info changed event, lineinfo_watch_read() populates and returns the gpioline_info_changed structure. It contains 5 words of padding at the end which are not initialized before being returned to userspace. Zero the structure in gpio_v2_line_info_change_to_v1() before populating its contents. Fixes: aad955842d1c ("gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL") Signed-off-by: Gabriel Knezek --- Changes in v3: - Include the Fixes tag referencing the code being fixed and properly version the patch. Changes in v2: - Update commit message and subject with suggestions about clarity. - Patch series at https://www.spinics.net/lists/linux-gpio/msg62163.html v1: - Initial patch - Patch series at https://www.spinics.net/lists/linux-gpio/msg62084.html drivers/gpio/gpiolib-cdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index ee5903aac497..af68532835fe 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -1865,6 +1865,7 @@ static void gpio_v2_line_info_changed_to_v1( struct gpio_v2_line_info_changed *lic_v2, struct gpioline_info_changed *lic_v1) { + memset(lic_v1, 0, sizeof(*lic_v1)); gpio_v2_line_info_to_v1(&lic_v2->info, &lic_v1->info); lic_v1->timestamp = lic_v2->timestamp_ns; lic_v1->event_type = lic_v2->event_type; -- 2.25.1