Received: by 10.213.65.68 with SMTP id h4csp499996imn; Fri, 16 Mar 2018 09:37:25 -0700 (PDT) X-Google-Smtp-Source: AG47ELsun5/tX5azIFmtyOFL6DiNL4TUMI1b6WNeHy6AkLz49LKymBx4I37u+IQXYPJfnTOI/bpF X-Received: by 10.99.165.22 with SMTP id n22mr1927583pgf.53.1521218245816; Fri, 16 Mar 2018 09:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521218245; cv=none; d=google.com; s=arc-20160816; b=P+FV3G0O5QA3Yzd96BAGpm1DO8kXrU69TztiuDL73hCWrBD3v2hZiqMOHhr3/e8QLA k6/8H4/jRAFsHXaDm1vcQ2FYNQoDPuwFucruoHwbhmtexxzWEAjFdHHSH5OIyeppgaDu JjxzDmLelcfLwNyVCFZAKzB3ryv6J3o7lMEm/3Zibo2WvN2yjO/jimeXEvfcwSwjd9zL t0ZpHxlfaxxexTp8z93o1hJurduwxjzQGgqZcnhcpKoQ5eg57c8a+Iq6rw8ZJ38JNUOs VW8ChUSa4+VVMSXTFQaamdzd4g3RHqUdO0yCCE02b1gwpHOKojJdiFVtlM6rkpectkJ0 uQxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=uVYXLfG7pwAZ5hm5rCJTq62cWYXM9D1A173JMbzlWm4=; b=Rb9X3B8nw+5XTi3dS+f/lEJfju4rnjw/ffUOUhu4JRY1E0KZdCtovwUn6Am1OoSI4H Iuboh0mD1QU5A0ZvYbn6dQ0VnEHxZwjLoQe/glVL8kSyqWNga2j2rE+eoHyZbmkIoKzr sxTwhad2aFXpGO4blb73yxo9hMkVYAXDfKjIInQ5+rKbrQOEEUL974Vxsfoe4E2h/fG5 PgSekKmjN2i7fOV0ma4ycjma0/zpWOGoz0VLgBfEKIiBXKiG5Krw7Bm9jn4IvsYYxrD5 30UHUlIfgouGAVq0OIBDuymlI0l9mU50vfYEQSAvTs+IOXaRmwla4liNfpzAtA1FLGGn dcUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a100-v6si6497171pli.483.2018.03.16.09.37.12; Fri, 16 Mar 2018 09:37:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753097AbeCPQel (ORCPT + 99 others); Fri, 16 Mar 2018 12:34:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42048 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934472AbeCPPiC (ORCPT ); Fri, 16 Mar 2018 11:38:02 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BB899125B; Fri, 16 Mar 2018 15:37:51 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 088/109] media: davinci: vpif_capture: add NULL check on devm_kzalloc return value Date: Fri, 16 Mar 2018 16:23:57 +0100 Message-Id: <20180316152334.717839256@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Gustavo A. R. Silva" [ Upstream commit 5a18c2434f8bfc8bc2fb0f8af3e44f7408d63e4f ] Check return value from call to devm_kzalloc() in order to prevent a NULL pointer dereference. This issue was detected with the help of Coccinelle. Fixes: 4a5f8ae50b66 ("[media] davinci: vpif_capture: get subdevs from DT when available") Signed-off-by: Gustavo A. R. Silva Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/davinci/vpif_capture.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1545,6 +1545,8 @@ vpif_capture_get_pdata(struct platform_d sizeof(*chan->inputs) * VPIF_CAPTURE_NUM_CHANNELS, GFP_KERNEL); + if (!chan->inputs) + return NULL; chan->input_count++; chan->inputs[i].input.type = V4L2_INPUT_TYPE_CAMERA;