Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp406353ybe; Wed, 4 Sep 2019 01:25:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqybjSk2EwuVTK/ZNmiKQgJAcy6kibj3daNgrVECO6JMuOvVKR/HSr01wmKvpBoaCkDqul/J X-Received: by 2002:aa7:8592:: with SMTP id w18mr19251917pfn.237.1567585501809; Wed, 04 Sep 2019 01:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567585501; cv=none; d=google.com; s=arc-20160816; b=nxZNopMIG0K/8aAz1RhpVmhxbT2XM07CRABSdJF8/Vo9s404DrbnAb3t0Q5gGxGK8h h4E/LICe78n+kQIsheTuKHFqETdKsbYlZA61+hCcwrCZQg51xnNqCnDoladUOPssgSkK XNkdpiAuNj+ZB28wlI9gbm0ZFrL4jnsw2GcR37xDANLpfwkgpV995YfYPQk7L5lTvs7g qNvsrJBch00tSk5SmAAPwREUPfZxw3Qea3mYaetT53wdoiG39Ab8XwO3a4B/GBSB6nLs 8O1aTjtAC4tsSAmbWCWfpBxi2OJxjLh+Ehb1+G0Lr8hyTMsw/oqrWgjDzizre0E+NJjo BKJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=R+MTq1VS0iR1Cmy3+6Y5RTbLGGusOaeHEDjli8lEEug=; b=PY2GzAvw5mgl+N/EgmgSAUsh58vG3Cw31weYg7Xdw0YrgUQzX8mf+0wlBFIMK2pJW6 zWSaBpMwgHE3aqfLzspglrtppmoYt01yEa8hp9TU1kPcc9qQUhArGGd5q8IumotPhrdV zn8z5kM7sLaVBr9QATR+xxHqTXPMlSHuqfiNAhXZBmPP8czWW35SP/hQLSF64cI1+JSO Vbbouxo2xCV4AMqzylPidTlkefnAVsjjtFPwHb6+vZBBbuKa7QBvUSlEX9i/mRbhjnjZ k6yAg1tIfmQMKIEZTpPYe5IwHUbnhveX9VXyHjNbFPxNZYhrK8RwLiGI6qIu2+LDcAn4 ssBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RTBHYoMu; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m15si16994167pgt.495.2019.09.04.01.24.45; Wed, 04 Sep 2019 01:25:01 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RTBHYoMu; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729001AbfIDIWj (ORCPT + 99 others); Wed, 4 Sep 2019 04:22:39 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:39224 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbfIDIWj (ORCPT ); Wed, 4 Sep 2019 04:22:39 -0400 Received: by mail-pl1-f196.google.com with SMTP id bd8so2914376plb.6; Wed, 04 Sep 2019 01:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=R+MTq1VS0iR1Cmy3+6Y5RTbLGGusOaeHEDjli8lEEug=; b=RTBHYoMusuZZ5AhgQVW4Ifku1G8VvN4Ll0zy023Lbai0cViQEH2bR6Iui/by5YW1Ap Q6aYgQSGI9o/EGk+Sn2VF2wxSMZqyDRoqmknxzQNcPNtlmHeghzyeCGm/q0giQ5NFWNI C1HvKXxbYbV0VHTuxz6/Ip6QnSNpNZ7ZMUOImib8g8ItRoRcH8mTzwGOHTTTOy2waQ94 nO0BsM7b0Rma+caRCrzA2ZsNaEfBYIhVnamBuZcaQOilnxF5VtbynTkCur6tN8LvjwEh /KdfPBtSwEEHmECBR3CasdP57gyGVdxJVcyyG2tk4EHazua53hS5K8I6uuUcqLLB9kyZ BY0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=R+MTq1VS0iR1Cmy3+6Y5RTbLGGusOaeHEDjli8lEEug=; b=ohAXDD56uu8I8EfU79WHFA9dmRPW895StVjl0hOi/F4tjwvPkHV4CTodvCywqJWgvT INYRHEn1QbhYhb0YxwZRnlNBEw0wMMQwtJceOAzuWdLS6PkbSu2UnQd1yErzEEi6ClhO tlGsY1sPjUjnErdMvAsKi2kMOXRZniNgN8JqJZ6SGntpXp5f09padNgGnrB95wGqgtrj AguG25o8ZqWj2vL0ON+zn9jjCGuP8H+CvN6VBZ6X9FmnbbhbgXNOXyPfB/xSQQXs4epa /PxIOB2IA6r+j7tQHUmH4BqfEHJcX4fOqe34BQuvYFj3F6NgUHzdaVI4ZK3TrkDgVylQ DA5g== X-Gm-Message-State: APjAAAWK+LdtN1ZIKgy9JlWK6obtWyOCUN94SvCDbhCpMMr6NQhv29DL LYBTuabRLXjfn5bTwAE0y34= X-Received: by 2002:a17:902:8345:: with SMTP id z5mr41132525pln.29.1567585358436; Wed, 04 Sep 2019 01:22:38 -0700 (PDT) Received: from LGEARND20B15 ([27.122.242.75]) by smtp.gmail.com with ESMTPSA id y8sm22025894pfe.146.2019.09.04.01.22.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Sep 2019 01:22:37 -0700 (PDT) Date: Wed, 4 Sep 2019 17:22:32 +0900 From: Austin Kim To: mchehab@kernel.org, khilman@baylibre.com Cc: mjourdan@baylibre.com, gregkh@linuxfoundation.org, linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org, devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: meson: Add NULL check after the call to kmalloc() Message-ID: <20190904082232.GA171180@LGEARND20B15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the kmalloc() return NULL, the NULL pointer dereference will occur. new_ts->ts = ts; Add exception check after the call to kmalloc() is made. Signed-off-by: Austin Kim --- drivers/staging/media/meson/vdec/vdec_helpers.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c index f16948b..e7e56d5 100644 --- a/drivers/staging/media/meson/vdec/vdec_helpers.c +++ b/drivers/staging/media/meson/vdec/vdec_helpers.c @@ -206,6 +206,10 @@ void amvdec_add_ts_reorder(struct amvdec_session *sess, u64 ts, u32 offset) unsigned long flags; new_ts = kmalloc(sizeof(*new_ts), GFP_KERNEL); + if (!new_ts) { + dev_err(sess->core->dev, "Failed to kmalloc()\n"); + return; + } new_ts->ts = ts; new_ts->offset = offset; -- 2.6.2