Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2653948pxa; Mon, 17 Aug 2020 15:36:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuj+pHNUFV0D+28qWJj0cyJADBc3gCKUN17Z4nS2kJEiDb+szikAEuccHC3+2fQ9Jy43NF X-Received: by 2002:a05:6402:17a4:: with SMTP id j4mr4604171edy.52.1597703813014; Mon, 17 Aug 2020 15:36:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703813; cv=none; d=google.com; s=arc-20160816; b=DGwKnUdllfLV3nEZ4f5GVYFxl3Kuy+QHRQQ4s5p8GKBPN8chTppwr7Sj8urhBwbJ60 xUHfEe4F3f/urG4V6Jov4u2B8cJZlVS/AfiAjUqihCkw0DSCt10TGPKGxyLNpDXfenD9 WWZiqsVNV+sRQVflRHiI0BZ7RD3hW6qka2I30nFvanQfj0JYokgDF8KxbG/jbrrtBzTN jZCcKojCAlV4v6+zEd/l/IzqDXMS57D+yBYqjacmDbtULPveG+YLMqSaBQfPnmeYURIC yqkkKuX/hO5wvxqcAPRgjYO9ELjJkXz4t6G+409cEzpSHqRdhbNsfvF/sGVgJ0O3viJX HIWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W3OvCUjByd7oxC//iE8rIV77G1fGe1beXipuRZ2MhmE=; b=RHqQ5bQG07nTlq+8V1qTLJPcZr6LZctymWY86wbZ5CYmuqHOZGk2BWQZj/uW2A5e/c kH1m80WbYAhHyeKGEZP7zYm3Jb6g4A0R3qvJUcwUs357k7HZocWou8VSI0gfBV4b9JF/ tOKnAJN1iyZvWDHH7NtlnQOUZD5oOCiFsqSY2RLShfwp0BYDmbn4UIJc3hu3ZkfC+GZd nKGb6+hzMcAeA2x2mhIq/mCHZsSrXgUy2HogvkfdZiAWYvSW1cdtonYTU2IcjaxoLqXU h/eJZzZKdCvg993gksgiZmFvGC4xUS2zwcs7GYqNzXui/UJHiCOyuvElKnbGK50PVjti gNBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rzt+NtfK; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si11868576edq.334.2020.08.17.15.36.29; Mon, 17 Aug 2020 15:36:53 -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=@kernel.org header.s=default header.b=rzt+NtfK; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389641AbgHQRRo (ORCPT + 99 others); Mon, 17 Aug 2020 13:17:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:52880 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730957AbgHQQPD (ORCPT ); Mon, 17 Aug 2020 12:15:03 -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 33DBB20658; Mon, 17 Aug 2020 16:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680902; bh=aMXRQbGt+myTEvXRk+LaenodkxkzD/fx6yGyb7R01sw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rzt+NtfKqI71imvAA86hTHG2HLp2qdFfACuTTa0ilalsKw2cU7c5OhUrvJtOabS6P 5zaohCETPOJfvnVahKbx/1JUCB4Cm79PoGxY37x+OyZe3Eua2DoHCeVRBem5yiBuC/ 73tZNcf8EecnCGmgEB+b1R7m5KFIIp5eQjXa4tHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 073/168] media: firewire: Using uninitialized values in node_probe() Date: Mon, 17 Aug 2020 17:16:44 +0200 Message-Id: <20200817143737.355562192@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143733.692105228@linuxfoundation.org> References: <20200817143733.692105228@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 2505a210fc126599013aec2be741df20aaacc490 ] If fw_csr_string() returns -ENOENT, then "name" is uninitialized. So then the "strlen(model_names[i]) <= name_len" is true because strlen() is unsigned and -ENOENT is type promoted to a very high positive value. Then the "strncmp(name, model_names[i], name_len)" uses uninitialized data because "name" is uninitialized. Fixes: 92374e886c75 ("[media] firedtv: drop obsolete backend abstraction") Signed-off-by: Dan Carpenter Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/firewire/firedtv-fw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c index 92f4112d2e377..eaf94b817dbc0 100644 --- a/drivers/media/firewire/firedtv-fw.c +++ b/drivers/media/firewire/firedtv-fw.c @@ -271,6 +271,8 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) name_len = fw_csr_string(unit->directory, CSR_MODEL, name, sizeof(name)); + if (name_len < 0) + return name_len; for (i = ARRAY_SIZE(model_names); --i; ) if (strlen(model_names[i]) <= name_len && strncmp(name, model_names[i], name_len) == 0) -- 2.25.1