From patchwork Thu Mar 10 13:23:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 12776332 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA1D4C433F5 for ; Thu, 10 Mar 2022 13:23:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242373AbiCJNY6 (ORCPT ); Thu, 10 Mar 2022 08:24:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236943AbiCJNY5 (ORCPT ); Thu, 10 Mar 2022 08:24:57 -0500 Received: from gofer.mess.org (gofer.mess.org [IPv6:2a02:8011:d000:212::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1DE09A4DC; Thu, 10 Mar 2022 05:23:52 -0800 (PST) Received: by gofer.mess.org (Postfix, from userid 1000) id D40B310001B; Thu, 10 Mar 2022 13:23:50 +0000 (UTC) From: Sean Young To: linux-media@vger.kernel.org Cc: Dan Carpenter , smatch@vger.kernel.org Subject: [PATCH] media: lirc: suppress false positive smatch warning Date: Thu, 10 Mar 2022 13:23:50 +0000 Message-Id: <20220310132350.78729-1-sean@mess.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The latest smatch says: drivers/media/rc/lirc_dev.c:632 lirc_read_mode2() error: uninitialized symbol 'copied'. drivers/media/rc/lirc_dev.c:671 lirc_read_scancode() error: uninitialized symbol 'copied'. This is a false positive since in all reaching code paths, copied will be set. Work around this by providing a zero initializer for copied. Cc: Dan Carpenter Cc: smatch@vger.kernel.org Signed-off-by: Sean Young --- drivers/media/rc/lirc_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 765375bda0c6..efa09beae6a7 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -601,7 +601,7 @@ static ssize_t lirc_read_mode2(struct file *file, char __user *buffer, { struct lirc_fh *fh = file->private_data; struct rc_dev *rcdev = fh->rc; - unsigned int copied; + unsigned int copied = 0; int ret; if (length < sizeof(unsigned int) || length % sizeof(unsigned int)) @@ -639,7 +639,7 @@ static ssize_t lirc_read_scancode(struct file *file, char __user *buffer, { struct lirc_fh *fh = file->private_data; struct rc_dev *rcdev = fh->rc; - unsigned int copied; + unsigned int copied = 0; int ret; if (length < sizeof(struct lirc_scancode) ||