Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp429246pxk; Thu, 3 Sep 2020 03:39:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylDqpz63re4KZ89D12m2d1gL+gG3yUFD3IBOIXbIXmT+XfgrBJ6OKmAI6BIH6xAF/W5n4/ X-Received: by 2002:a17:906:b6d5:: with SMTP id ec21mr1373998ejb.396.1599129570302; Thu, 03 Sep 2020 03:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599129570; cv=none; d=google.com; s=arc-20160816; b=ErjRPiDy4HAZamyhELtj6ZdBNtOysvC+5zUjxj43bU2f2OoGw+ksVn0O+CVSpN6NUi R8msS/o7Hr6oezsBaQ42bDmBwWPxWg1+3xWMG6qrAxace82k/qYI72iKkH5ZP7dAVyRH 0o8OTdl38Mebdqv4T8Unz+26gGCI7oij5tkD7P6ijDIIrLTz3hqlu73wQ5DogOBKtslT npKUGr0lppsTGhUIQjcHlAWSH6MtqXdGktWlNo3SOFRr/dM6k4CFpOfW6tFiaR1p9xfM +Gflb0bcBnzstzalUXtTUk1Rz+w/PbN8BZjGrTE1Ad6y4satYo8k0UVgHEAcxAhQyh/F A0BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=LAXgYKBZSgHnpP3vkKbhWFMU0X4+abqBQN6jvUOWbqY=; b=Rcw52jaUeNpdIg8WlgOuxWWd8dxLLGTzXQ5p5Z3yMJ/uFNzLYbkhbdzleKOktD8HX6 VkH2nCWwfz9t5Qxu6pZnJOBuQkf60+r+sUdArERPUa1KFgcy1mbrbEDenV0QhLK3m8ad KOIq8UEAQm5M9E+29nwjcsIj1rRjOp2ihgUdr/DK6VtfiH7xab4NtE7wS77BSQnjGetm 8nz1uFEnLmxBydss4tsZXYDgt4jJQE0i+iPf3Q6MupNx6ERTAMIXPWSX8l+UOK2YbIc1 kN/wgkaBsywoJDTMCnW3tGCtWFUTbpKDhtOThpslSsfkvSmEoyPBnnZ+vbGgan0GYl0c 8anQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ld1Q2yf2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si1576392ejj.109.2020.09.03.03.39.07; Thu, 03 Sep 2020 03:39:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ld1Q2yf2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727857AbgICKi0 (ORCPT + 99 others); Thu, 3 Sep 2020 06:38:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37598 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726025AbgICKiY (ORCPT ); Thu, 3 Sep 2020 06:38:24 -0400 Received: from localhost (unknown [213.57.247.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FBDD20716; Thu, 3 Sep 2020 10:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599129504; bh=LAXgYKBZSgHnpP3vkKbhWFMU0X4+abqBQN6jvUOWbqY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ld1Q2yf2X4ppe6E/1c7dmW3CA+UkvzGxs9ys4JpwdZiYXo2bHei/hIwZyyuZvtNzA NKuGMmyikL5JlRlBn0fZ7UrAPjRMCZkyEhihJyUD+GoBP1BGBrGS9RZn0lCaUA7VmV YRiU01bnSfLZSu9kHl482I7piLbAX2hS/lbCXO2I= Date: Thu, 3 Sep 2020 13:38:19 +0300 From: Leon Romanovsky To: Rasmus Villemoes Cc: Linus Torvalds , Peter Oberparleiter , linux-kernel@vger.kernel.org, Colin Ian King , Andrew Morton Subject: Re: [PATCH rdma-next 2/4] gcov: Use proper duplication routine for const pointer Message-ID: <20200903103819.GA1137836@unreal> References: <20200902085513.748149-1-leon@kernel.org> <20200902085513.748149-3-leon@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 03, 2020 at 10:56:38AM +0200, Rasmus Villemoes wrote: > On 02/09/2020 10.55, Leon Romanovsky wrote: > > From: Leon Romanovsky > > > > The filename is a const pointer, so use the proper string duplication > > routine that takes into account const identifier. > > This commit log makes no sense at all. > > kstrdup_const is merely an optimization that can be used when there's a > good chance that the passed string lives in vmlinux' .rodata, in which > case it is known to be immortal, and we can avoid allocating heap memory > to contain a duplicate. [It also requires that the caller has no > intention of modifying the returned string.] > > In the case of something called ->filename, I assume it's initialized > with __FILE__ somewhere, making the above true for built-in stuff but > not for modules. So if the gcov_info can live longer than the module, > it's of course necessary to duplicate the string, but OTOH making an > optimization for the built-in stuff makes sense. So this is certainly > one of the places where kstrdup_const() seems applicable. But it has > nothing whatsoever to do with the C-level qualifiers the argument may have. Thanks, GCOV can't be built as module. > > Rasmus