Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2641905pxa; Mon, 17 Aug 2020 15:14:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpGOtUL5Ur7/meuyI9qOr2a4oscCMXwK4Uz/eGo3XUXSljwmtvDLNAQJyeSd+VSCFr+kRa X-Received: by 2002:a17:907:1183:: with SMTP id uz3mr17038775ejb.216.1597702499076; Mon, 17 Aug 2020 15:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597702499; cv=none; d=google.com; s=arc-20160816; b=pBFaPBWxrGmHEkCfV1KKrzzy0q7QNEsfArCLria57bvwOYS845Q+GHZVr2NLU4mzzj ecpWnm4tWjypl4K742SG5bYR7geA5A7u3zS9baV+73AzPIQS4vd1toLwVhV0vl4Vp1LX YDDKxIILlmtYb6vpTNxNNKvC3RvTKrPc79+4TftzEy4TDlm3KtLCKs89/hWWHMOXVQS0 ZsAYjDB4+uovZUrOqA9m3qjJu7Pcy7J/YGr8gyFeV4azl3ulATr3R1ORwQfiwE50YVEy aGamCdHoHfGJ4f6XmX9M1/n58YLQitrqK5oGFt3pr6Fn2yZT+lOHYUudpxMx9B8un0Z3 hwmg== 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=O21Uq2K2DvkJCKdwErZw7ov2eho2RYm99+n3CzW2vP0=; b=rYGxxpIZT5+8DNhKjcBRSNzJrD7JAthmD6osyOPdGey00AMl6NyKSH7p+KIc97/WjU vu2rsa11Bcm0URbvC4WbPXtFe0vTrRYQP5wFuWe1AuoGk/5W+VotBm3OxIJQrsCakYND kwzIDFOaNfJSn4U3HazAc3yV7st5gbevdMOyAnwEiPAg2uz4LnWWNBPIkvNfGakKBnoG 4bsWubPhjyWTVk9kGXfVTVPyyhsgc7IQlSTDSC1wtc11fS7hzyg25Az+LNCyPcrcLEeI sfxwjqfwouPY2T8+ocbPdZo6isGoPODeLJod8G4mbXQQVgmL85i+3ClUKnHM3XJ0ONBf 1HSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hQ9d7g59; 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 a12si11460947ejd.417.2020.08.17.15.14.35; Mon, 17 Aug 2020 15:14:59 -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=hQ9d7g59; 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 S2389247AbgHQQ5O (ORCPT + 99 others); Mon, 17 Aug 2020 12:57:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:52586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388340AbgHQQEo (ORCPT ); Mon, 17 Aug 2020 12:04:44 -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 BE15B206FA; Mon, 17 Aug 2020 16:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680284; bh=A5cDiprIgsMvCjnEr/jbEPmBcCQcz0QY9VuRftCkkn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hQ9d7g59mbqZ2dl9ymC4S4lM9IAruMQVLVGdPD+yGj+J1Tgu4L1kChWIkp/wjewsB BAkcOl/G3AgfDlf0p796IBxb4UnEw/nE9U2hUb3BbkR9L1jpJHUHNJIDbsdatiTOta C8EczJsbIpZ/PDjfefWHFpZsAhmsLyyZo8T0x4BQ= 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 5.4 124/270] media: firewire: Using uninitialized values in node_probe() Date: Mon, 17 Aug 2020 17:15:25 +0200 Message-Id: <20200817143801.952102926@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@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 97144734eb052..3f1ca40b9b987 100644 --- a/drivers/media/firewire/firedtv-fw.c +++ b/drivers/media/firewire/firedtv-fw.c @@ -272,6 +272,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