Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3315386imu; Wed, 7 Nov 2018 08:26:27 -0800 (PST) X-Google-Smtp-Source: AJdET5ctulX6WWugkYnK3ylHDR/uQXOhUxA8vldWvcI6E2ciAon2Kyt4r/l4aESDf060I3g60igQ X-Received: by 2002:a17:902:a405:: with SMTP id p5-v6mr876529plq.284.1541607987924; Wed, 07 Nov 2018 08:26:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541607987; cv=none; d=google.com; s=arc-20160816; b=wFVaIRnRWnwpEM1vt2cv6eK6SvsapaEYgdoupR1MEikb2pX+KsZ4AhBhcvSFcvvAdz UxuyB2aZNYTuJCUa8scU9dh+JxSHAMRzSNkkBKFZJllgJPEvLHKu3y1muSpx1EH918vO W5636m0+dDJ/luguQL3PBI/jWlWSv22COB89uDg2awuLyM/s0Z4Z4z8BQ7uDLPFQuLlf Bdmnhqrpe1oheh3o9GZCwBDxBDO5BGanG+dLSE/Uw29+h2e5Og5fRaCQTsUfQauPY8b9 Gj1rCOWQWFMvaOqB4OjbLF3vT82R/PX3BaT4VJVzzqqcycJhEgXuLJrLhFInR+E0lTNy gy4w== 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; bh=UgeFNADOiNFYTj5g764u4Y9deKUEsi6SfqJnMi5hK7k=; b=Mft0/blkD8HcbL1Fg3GFmwdYnboDCcyoC6fHR6dFUQOs7ga8Q/LMfkppz409lhgVKS s3TH2vPNtq/wr8Q+K5FQDSdHaiMJSX4FiiGfTFh1DyE1xYU2N6nYidT7+hO1+tyLgyjp j2aHIDPyYBA6jtxQEgvQwGRrasDaksHIGcEMeSoVW1wdM5MYniVYjzOOnAoU09PCVt62 uaJK72S2HcWfLB9eI9oeOxdKSZVNL1rxFPZ/LI5Xz36bhaIkkTkup9ewT3MhhMaZdpCW 7TiKXylv8DTLRn263pPrcVTIug0g8voaO4JC2D1nyn8Ss9Tl4KQfkm2kgt+/MJ3+5TG7 OEjg== ARC-Authentication-Results: i=1; mx.google.com; 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 185-v6si1047044pff.270.2018.11.07.08.26.12; Wed, 07 Nov 2018 08:26:27 -0800 (PST) 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; 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 S1731393AbeKHBzA (ORCPT + 99 others); Wed, 7 Nov 2018 20:55:00 -0500 Received: from mail.bootlin.com ([62.4.15.54]:35209 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727546AbeKHBzA (ORCPT ); Wed, 7 Nov 2018 20:55:00 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 1C910224CD; Wed, 7 Nov 2018 17:23:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (242.171.71.37.rev.sfr.net [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id E6DEF20712; Wed, 7 Nov 2018 17:23:54 +0100 (CET) Date: Wed, 7 Nov 2018 17:23:54 +0100 From: Alexandre Belloni To: Xulin Sun Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, xulinsun@gmail.com Subject: Re: [PATCH] rtc: pcf2127: fix a kmemleak caused in pcf2127_i2c_gather_write Message-ID: <20181107162354.GE21694@piout.net> References: <1541493739-85733-1-git-send-email-xulin.sun@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1541493739-85733-1-git-send-email-xulin.sun@windriver.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/11/2018 16:42:19+0800, Xulin Sun wrote: > pcf2127_i2c_gather_write() allocates memory as local variable > for i2c_master_send(), after finishing the master transfer, > the allocated memory should be freed. The kmemleak is reported: > > unreferenced object 0xffff80231e7dba80 (size 64): > comm "hwclock", pid 27762, jiffies 4296880075 (age 356.944s) > hex dump (first 32 bytes): > 03 00 12 03 19 02 11 13 00 80 98 18 00 00 ff ff ................ > 00 50 00 00 00 00 00 00 02 00 00 00 00 00 00 00 .P.............. > backtrace: > [] create_object+0xf8/0x278 > [] kmemleak_alloc+0x74/0xa0 > [] __kmalloc+0x1ac/0x348 > [] pcf2127_i2c_gather_write+0x54/0xf8 > [] _regmap_raw_write+0x464/0x850 > [] regmap_bulk_write+0x1a4/0x348 > [] pcf2127_rtc_set_time+0xac/0xe8 > [] rtc_set_time+0x80/0x138 > [] rtc_dev_ioctl+0x398/0x610 > [] do_vfs_ioctl+0xb0/0x848 > [] SyS_ioctl+0x8c/0xa8 > [] el0_svc_naked+0x34/0x38 > [] 0xffffffffffffffff > > Signed-off-by: Xulin Sun > --- > drivers/rtc/rtc-pcf2127.c | 3 +++ > 1 file changed, 3 insertions(+) > Applied, thanks. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com