Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751933AbdITIaV (ORCPT ); Wed, 20 Sep 2017 04:30:21 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:36721 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751783AbdITIaT (ORCPT ); Wed, 20 Sep 2017 04:30:19 -0400 Message-ID: <1505896209.7865.1.camel@pengutronix.de> Subject: Re: [PATCH 1/2] [media] coda: Handle return value of kasprintf From: Philipp Zabel To: Arvind Yadav , mchehab@kernel.org, hans.verkuil@cisco.com, sean@mess.org, andi.shyti@samsung.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 20 Sep 2017 10:30:09 +0200 In-Reply-To: <1505893033-7491-2-git-send-email-arvind.yadav.cs@gmail.com> References: <1505893033-7491-1-git-send-email-arvind.yadav.cs@gmail.com> <1505893033-7491-2-git-send-email-arvind.yadav.cs@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 950 Lines: 28 Hi Arvind, On Wed, 2017-09-20 at 13:07 +0530, Arvind Yadav wrote: > kasprintf() can fail here and we must check its return value. > > Signed-off-by: Arvind Yadav > --- >  drivers/media/platform/coda/coda-bit.c | 3 +++ >  1 file changed, 3 insertions(+) > > diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c > index 291c409..8d78183 100644 > --- a/drivers/media/platform/coda/coda-bit.c > +++ b/drivers/media/platform/coda/coda-bit.c > @@ -417,6 +417,9 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx, > >       dev->devtype->product != CODA_DX6) > >   size += ysize / 4; > >   name = kasprintf(GFP_KERNEL, "fb%d", i); > + if (!name) > + return -ENOMEM; > + Thank you for the patch. Instead of just returning here, this should also call coda_free_framebuffers to release already allocated buffers in earlier iterations of the loop. regards Philipp