Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp457940pxp; Wed, 16 Mar 2022 09:08:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyalSuDJUtdQMyK2AK72qcATaVL5XHGn7BLpco/QC5PascobvAPGOiMgA4MOWuxRFAUX4II X-Received: by 2002:a05:6a00:10d0:b0:4f7:5af4:47b6 with SMTP id d16-20020a056a0010d000b004f75af447b6mr56919pfu.6.1647446884469; Wed, 16 Mar 2022 09:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647446884; cv=none; d=google.com; s=arc-20160816; b=oZ8rofRc3zOxQp4brUmKarftjGeDKhnS5X0sRYu1JlDVqJ+NXDqrt6pUrY1ib78ilq pqqi6h8/iUFxkIzfyBqh0gRWbnUpq/pLr5gMDqgjQfxhCkOhOuWJcdE2Frlt4IEbpn7O wwxqPb39Jta2aKS8sMToMh8p8lSIS0glMT8fWjfdM3Etevn3v2xkHDWdlnYyZZz2mqpF MJz9H3EyuPFyFo4/W87h53KLamq2eJrgGd4H3gC2KoU/1stKQxm50XW270E63w4ttasu gfNFWLKZd6bSEvTWYfNKdZ/MH24oUz6zcJeQmQoasE+CI6N1/CPvon2Fj7LE7Jz7GlTo CIgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=u2IVWKsZWDnjdIfy+pnZx/xLZQJgw/QqF4BIWMQ9vH8=; b=d44nkmUBrnwJ8a+iw6N1kRtD/0LHPzQgSWQ56T5CRAEz3X13PuS8k1pug9Icmi/bOG iAUV+9o60iKIu9maefLBPyXHVC107cyNv7/zWDpV09nPzsSdG2jcPnyAetEbbFyIYOmr rZC2iAe2OmXqGzkt9fsFWGgjvUK8jR1cBcCQhMad0RDjTasYZQTVXdpB3Zq9AafzCmeT 3CVX1fuLZJK0MI72Z/wsUYpRygb06ZwYUy3ZdbgwTRSleXmu554osUxkLgqS5SNI0Mw3 Lym3HbmS0NWNRGWX9K4dVErAcnr5jcObfY97At4vYwkxGHpIIE+g6MZsaghfy0mjjMGq mAZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aKY/p9D/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g13-20020a056a0023cd00b004f9fa4b0c96si2614790pfc.152.2022.03.16.09.07.46; Wed, 16 Mar 2022 09:08:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aKY/p9D/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349608AbiCOP25 (ORCPT + 99 others); Tue, 15 Mar 2022 11:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349605AbiCOP24 (ORCPT ); Tue, 15 Mar 2022 11:28:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19B6050E16 for ; Tue, 15 Mar 2022 08:27:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8FECF6122E for ; Tue, 15 Mar 2022 15:27:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57A5EC340E8; Tue, 15 Mar 2022 15:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647358063; bh=ntKc+0V/pCo1xdEL+4LSr3fmP+YcSlucBc+b0X8zhMM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aKY/p9D/m7fo/AZ+uALMMw5azq5ppZgYThkPQFIRF6bAbz4/UXVtmJxcmc9QKRN/R 2513m5Lrel/4uYNnDhSv9HlgDmhgiACMnYOruOzTIX11s/WX4nYemsaWNbc4Qu2pY+ EGOh6rNjC2zVB5Bv/cdpc8JZ+EnPnWGXIovl7zbg= Date: Tue, 15 Mar 2022 16:27:38 +0100 From: Greg KH To: xkernel.wang@foxmail.com Cc: nsaenz@kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] staging: mmal-vchiq: add a check for the return of vmalloc() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 15, 2022 at 10:42:07PM +0800, xkernel.wang@foxmail.com wrote: > From: Xiaoke Wang > > vmalloc() is a memory allocation API which can return NULL when some > internal memory errors happen. So it is better to check the return > value of it to catch the error in time. > > Signed-off-by: Xiaoke Wang > --- > ChangeLog: > v1->v2 jump to the proper location and remove redundant instruction. > drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c > index 76d3f03..ff4b484 100644 > --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c > +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c > @@ -1909,6 +1909,10 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) > mutex_init(&instance->vchiq_mutex); > > instance->bulk_scratch = vmalloc(PAGE_SIZE); > + if (!instance->bulk_scratch) { > + err = -ENOMEM; > + goto err_free; > + } > instance->vchiq_instance = vchiq_instance; > > mutex_init(&instance->context_map_lock); > -- Your change just crashed the kernel :( Please be more careful. greg k-h