Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4737603iob; Sun, 8 May 2022 23:47:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkOGd2N2yQb3L/0K9va8AeEQRr6N7vGYDuj4XAaRSA5TisOMD9T9jInuPLVyVaTtx+9acw X-Received: by 2002:a17:902:e211:b0:15c:f342:2fe6 with SMTP id u17-20020a170902e21100b0015cf3422fe6mr15308731plb.18.1652078830552; Sun, 08 May 2022 23:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652078830; cv=none; d=google.com; s=arc-20160816; b=FzuVnC6tz7x0sOEu8T7S9XH7UBSimGUpQMQjsY9OjxcBywJlWnfKn0UVEYOAk7o4o/ CPbqtNhat1d4KqSGrx55Zwuj4/OLV5cRAqnNYZh+GEyx1r/L5eJMhyu+TVvFAUhQT+Gp 7ecLVDy7tkQxEczofvyMJqwcLm9W5/1FphGcpCvJnm2cr70EgoqAwRSzKDTPE5tgs9Gw INIBN2mTwcw5SGr6FWSB9GP4QQJ4vni2wYtwjuw/lL6vU4llbZPLWyCPKMG7XU5Do/gr dH89hciHae5fnv5XAOsZ8fS7W/YwTAFJkbOybbsg9peMR0xMX9u8Yl7IwJP3dXMmAvpP qG6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=N9RYLE4SRYc4Zl0s2GkDu/REA4wGPO6Eg8dsNFNbW9M=; b=r5ROold/CdQNg1J3nar6x88KpPoiFVzWJ7cbioc1SCFRev+udiF0kPOdETRxn/Lpx3 y/k5AkBrnY+w5jUd0EJHsscKShUseh58HLiyE81+4ABBCl65dDxOl+fWgVYWaoDyE61x xpxXSgTHiRxJDFhHxf9QUSD3aEjYUjP9xyTe6CZHpIzmRhFTVsqz6tm4ieNbIYzxZHw2 NOvG32pFEG/HW281/uzt6VRkgsTacZrxX5GdzkLhhNkQEzDL49vY8UNcHD2l8+MtovgE fVPPRZBiuVL9QSipppIbM8woh85TVgYU4QJyBzGG4jMjpoyCcKS3KgrsZdQGPpPWCU22 NgrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=IUKT7ejx; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 31-20020a63145f000000b003ab19fb15f1si14714242pgu.382.2022.05.08.23.47.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 23:47:10 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=IUKT7ejx; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 43DED18D4CD; Sun, 8 May 2022 23:43:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386897AbiEGStG (ORCPT + 99 others); Sat, 7 May 2022 14:49:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230421AbiEGStF (ORCPT ); Sat, 7 May 2022 14:49:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17DBB1E3CC for ; Sat, 7 May 2022 11:45:18 -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 A3CF261423 for ; Sat, 7 May 2022 18:45:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAC31C385A6; Sat, 7 May 2022 18:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1651949117; bh=uWrdHQqQJD2SDQCKl60JJdflwuAaux0Sd1WGRTkjd8Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IUKT7ejxpl5oJbVly9oY1vtdapHU0Rj/nmk7LHMI2JfBEZJut+DQucMr6dOtO8jcl E6HbXTcHVkavJHC5UFcSXPrx7UaRIpiCPUb77/edE/RxUqV2jyuPGXSxkdUL2H0rNs w4TYZEJLN94FsiYC4iT11gq8pZpFewiiir9g4ok0= Date: Sat, 7 May 2022 11:45:16 -0700 From: Andrew Morton To: Puyou Lu Cc: Andy Shevchenko , Kees Cook , Petr Mladek , Linus Walleij , Guenter Roeck , Chris Down , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] lib/string_helpers: fix not adding strarray to device's resource list. Message-Id: <20220507114516.5de49b46cf5349db7121eff8@linux-foundation.org> In-Reply-To: <20220506073623.2679-1-puyou.lu@gmail.com> References: <20220506073623.2679-1-puyou.lu@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Fri, 6 May 2022 15:36:22 +0800 Puyou Lu wrote: > Add allocated strarray to device's resource list. This is a must to > automatically release strarray when the device disappears. So at present we have a memory leak? Is this likely to be serious enough to justify backporting the fix into -stable kernels? > --- a/lib/string_helpers.c > +++ b/lib/string_helpers.c > @@ -757,6 +757,9 @@ char **devm_kasprintf_strarray(struct device *dev, const char *prefix, size_t n) > return ERR_PTR(-ENOMEM); > } > > + ptr->n = n; > + devres_add(dev, ptr); > + > return ptr->array; > } > EXPORT_SYMBOL_GPL(devm_kasprintf_strarray);