Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp377387pxk; Thu, 3 Sep 2020 02:00:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6sT1HBP0s75inWNiOy2sULzqXv7BHq7azBu5m6M0yy5oGYC1gCDRoMhOpYUV6qP4cQvhJ X-Received: by 2002:a17:906:1909:: with SMTP id a9mr1022403eje.127.1599123607999; Thu, 03 Sep 2020 02:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599123607; cv=none; d=google.com; s=arc-20160816; b=BJUerZcp9X9+12mj+B2jF9t0S3dJJ30elJamlGXRYFobs6+ZkyjhiTcZvf29sBe6IQ V55Unu/yEDC/oHZjXYlbG9y+kGGZjGT0q/Ya3DvQFa3iUdOO2LNRZx9BZVqOIkCX+pU/ LuhbxBDKiiyg/kZkiN9SenuKoBU3j2igZnB2d8kLio//6b/MxiqxokWMQQGq2MuPo2kr c4YlE25YT2n+qVFORs2QMcWJ3FhqMCqwWEBYb6XmIGhtKiB84IYby1yNy5JfK0W7gocs ajoOS4f+OuoKRDDk7Qv84C6GjYuUpH7qbIFxppTn0bsJsfdFM5UXwgYQy/DS6HpmfWd+ vnew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=oXnv/3I3RNjKPd3svQVgdHEHghFe6WwwdwtXUflXo84=; b=i99BCfCrvjQDgu/gVpN6k+IMbfWPxZAUOiY70PubJisVDNdBbTjApE9IXIFAA/rJgq lCdQSdW9fZ0awsqsG7/3+eZMJlUGAh61g6GzS8BxvU6qLM+iNp7CJvy+ecIuPmRWWU7i 8YR2ngW3qM2WdA05NUv1z3kNytEKiYfuqlxBLvnzl0qzVvzalMnurEv7Qd2XBi9lP/5s 7se+xETuw0WwWCPewRNFd98z8O7uUaFrhCIXtccT5MmK6hWhcuBQ5b8c7ysOhq/eoynz F2537Hul8T9lXWzgb4mYqwrv479KWi/Bmh3+J+3HZWgACWnoiAHdntrCR84vjMUAwpFU 0z0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=PB5wpvCU; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rs10si1496216ejb.625.2020.09.03.01.59.45; Thu, 03 Sep 2020 02:00:07 -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=@rasmusvillemoes.dk header.s=google header.b=PB5wpvCU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728401AbgICI4o (ORCPT + 99 others); Thu, 3 Sep 2020 04:56:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726292AbgICI4n (ORCPT ); Thu, 3 Sep 2020 04:56:43 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C80AC061244 for ; Thu, 3 Sep 2020 01:56:43 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id z9so2072150wmk.1 for ; Thu, 03 Sep 2020 01:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=oXnv/3I3RNjKPd3svQVgdHEHghFe6WwwdwtXUflXo84=; b=PB5wpvCUWl76RLt7pM40TQUJG77WeKZVBYLnDTVgmuVyo/3WmE+MX9MLNVNJBaAcvC Nx63GHZnhKhtRa3vgu8ZN57HPyJcQwBbY1xfaf3hpskoTOc9zL8ghfy93mhFFP+avL6x N1pQNKvOSUEKkRn0GeeFr++TicApz6ccx6jR0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oXnv/3I3RNjKPd3svQVgdHEHghFe6WwwdwtXUflXo84=; b=krEUZ4q0fZd50AS0BVOaFfH/jBJl4s7F5gEokg7q3X7pJw02/NwKUXkZ6OjkzsbyS0 qopYKkP+FqDM2yPeidteQk83iLycD013hCsemrupSwUI2RMK9vudDLaXxuv8eWr4AMvq osTrb66udvOsiaNdr4Jq4skVLvqgzqee1c34INaIv+XKF/n/6uNSkbSr8OMvGJE4o2/V I/Lm7WAK4vc/EJCHpCaxCRM6+C5LYy77TPYINxgBmhiMPO1HPoopAG/hMvyP+uaxuprr yT8qxkxvsKUvRaa231gw8U2vNbQmb38G2vR7ChR7D38/M1dZxbqsOe+KszYxpWHW6PZj omOw== X-Gm-Message-State: AOAM531pI/5JLUcFe1Qfmqq2jK0GD2UkxHwWJM40Yf7JOP1EGX8w2zsC R0ZJP7B6BYpwytKN6i6KAuTkmQ== X-Received: by 2002:a1c:e256:: with SMTP id z83mr1397695wmg.33.1599123400944; Thu, 03 Sep 2020 01:56:40 -0700 (PDT) Received: from [172.16.11.132] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id n4sm3230442wrp.61.2020.09.03.01.56.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Sep 2020 01:56:40 -0700 (PDT) Subject: Re: [PATCH rdma-next 2/4] gcov: Use proper duplication routine for const pointer To: Leon Romanovsky , Linus Torvalds , Peter Oberparleiter Cc: Leon Romanovsky , linux-kernel@vger.kernel.org, Colin Ian King , Andrew Morton References: <20200902085513.748149-1-leon@kernel.org> <20200902085513.748149-3-leon@kernel.org> From: Rasmus Villemoes Message-ID: Date: Thu, 3 Sep 2020 10:56:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200902085513.748149-3-leon@kernel.org> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Rasmus