From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E607C43331 for ; Fri, 3 Apr 2020 11:40:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C7DC2073B for ; Fri, 3 Apr 2020 11:40:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728068AbgDCLkZ (ORCPT ); Fri, 3 Apr 2020 07:40:25 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:21365 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728066AbgDCLkY (ORCPT ); Fri, 3 Apr 2020 07:40:24 -0400 X-Originating-IP: 86.202.105.35 Received: from localhost (lfbn-lyo-1-9-35.w86-202.abo.wanadoo.fr [86.202.105.35]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 88080240015; Fri, 3 Apr 2020 11:40:21 +0000 (UTC) Date: Fri, 3 Apr 2020 13:40:21 +0200 From: Alexandre Belloni To: Colin King Cc: Alessandro Zummo , Guenter Roeck , Chris Packham , linux-rtc@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next][V3] rtc: ds1307: check for failed memory allocation on wdt Message-ID: <20200403114021.GS3683@piout.net> References: <20200403110437.57420-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200403110437.57420-1-colin.king@canonical.com> Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org On 03/04/2020 12:04:37+0100, Colin King wrote: > From: Colin Ian King > > Currently a failed memory allocation will lead to a null pointer > dereference on point wdt. Fix this by checking for a failed > allocation and just returning. > > Addresses-Coverity: ("Dereference null return") > Fixes: fd90d48db037 ("rtc: ds1307: add support for watchdog timer on ds1388") > > Signed-off-by: Colin Ian King > --- > > V2: move error exit label and remove a return statement, thanks to > Walter Harms for spotting this clean up. > V3: simplify, just bail out and return on detecting the out of memory > condition > > --- > > drivers/rtc/rtc-ds1307.c | 2 ++ > 1 file changed, 2 insertions(+) > Applied, thanks. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com