Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp423969ybe; Wed, 4 Sep 2019 01:47:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTp3LqDVfQDD1a9+mJrEXGer7CHiHn9vj23VTrZHHKsDeX3gdhtPKqZ0bh3EBsF5K0q4iP X-Received: by 2002:a62:cf82:: with SMTP id b124mr24505877pfg.159.1567586826126; Wed, 04 Sep 2019 01:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567586826; cv=none; d=google.com; s=arc-20160816; b=I+XQmHISC2AzQNt5dghCPb2+b1NcdZX0DHUKuwu1q7fECyJ9hUKYSvHv1e/fNZ+U2c DVv2bo9bF81Tsh9C0dPj7pnZ56yVBe0znsgBaayc5T5hvDEFwmBGGSlpRiy8dwtBKv+3 /G+DpN7q8dqpFsjb8aHTd83eXu/D3QsHnT5dSCYyfe/n32zInoad0vg6XGWcCwYI6+VD E19iJK+yiMIizfEdfFCcn4XF/stXWKU2VGisMcu54MyERLMirTf4b2h62B0V99KCmQHC K7WzbVtV8TXLpy572fe+TV/+BBJZ5iy8LLusZbJiFgR/IM9QyoizgngtA5dkKvFMlJsc h/+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CpFTFxpGRui1puga56gZ3zA2oSghu1Vf4bhNGfkYmVM=; b=l+nKDIJdsGxgZ1Zc62pZMT42gGzqILO4DmiN5frofPcpesX2RAz2vlXTx4/nHjVY3E C+HjcGzXRVolSvztGKa2SZTih3wbLiOm0SxLe+kMz/ewVh30DeFejhUvLq4GmS4DXnuS vIqVr9eOG/juBBI4d7tBnQWWUn/0p5sjCVyr+NIZVuQN37ppzn3q3SPMdLmGWoOX4y0p SCgFDtmwWgOacGWKssF3XK1bVjQlevFzunfl2ZDQLaIkQgctSAbod6ytYQRHetyO++nR liIg2MHcwFtU1l7ecNlYgPVCAxwaIiKQ/cCK8ZV2wBD+TDqW48Mk0zhxwrYGv+wGNtys rLrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q3Xt1vFW; 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 s3si16472625pgq.392.2019.09.04.01.46.50; Wed, 04 Sep 2019 01:47:06 -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=@kernel.org header.s=default header.b=q3Xt1vFW; 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 S1729254AbfIDIp3 (ORCPT + 99 others); Wed, 4 Sep 2019 04:45:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:48002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726358AbfIDIp3 (ORCPT ); Wed, 4 Sep 2019 04:45:29 -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 81A8A22CEA; Wed, 4 Sep 2019 08:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567586728; bh=ReJN7nfBuAkxDGWCkNioWGAoCEhadI8k72Wr8vLuB04=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q3Xt1vFW/wLgQGkDEIy6pqv/t0kVUwS6A3oiUXXAYWBOsZHrhociWsvB2liN1QZHu +SSN7vWvBsPVq82ASvqxK10UF/FXwJaiuidUdpOlfaeNy50XOGVJC+DRhY7DTioILy jS6HbwoS0Jhjv1c7g1DMdZWsb7tvNRYs2pda0vpw= Date: Wed, 4 Sep 2019 10:45:25 +0200 From: Greg KH To: Austin Kim Cc: mchehab@kernel.org, khilman@baylibre.com, mjourdan@baylibre.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Subject: Re: [PATCH] media: meson: Add NULL check after the call to kmalloc() Message-ID: <20190904084525.GB4925@kroah.com> References: <20190904082232.GA171180@LGEARND20B15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190904082232.GA171180@LGEARND20B15> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 04, 2019 at 05:22:32PM +0900, Austin Kim wrote: > 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"); Did you run this through checkpatch? I think it will say that this line is not ok. > + return; Shouldn't you return an -ENOMEM error somehow? thanks, greg k-h