Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp805256pxv; Wed, 14 Jul 2021 16:20:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfKkZ8fW4NjLlEDV+GOEylmqUj5HE6hXydgNLQMfnI0U5z4klYI5CUFvl9NCGjQokOE8aF X-Received: by 2002:a05:6638:240c:: with SMTP id z12mr559168jat.41.1626304843950; Wed, 14 Jul 2021 16:20:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626304843; cv=none; d=google.com; s=arc-20160816; b=X8Ef8CoGp2n06lbxqtMlt4i0uoBZjLBgDD5gQa9A1q0AOvUVdX8f9pL4PlONohyNAA VyTRjJVUNyqr5Y95mw8mrLpXscw6xHC40VKOUns0slpkTqMwRAauTstob/ZnGDXEPnYI 2akLlQ5OZpj8cUUoOGSemjWgw/rgLZCRSL1A0XMNTM8kgny6rpJuC7d6YZ0iq0Gm2xN5 EgUOQEPChoUSSK80m+qhzpPB2ee++z9PTWoFPwPaOokydraP7q+lH2/QSze3E4DoAV7d E8Ttd58L3NG/djfrejXHxsC1CcS8Fb+gMmT4HpTvkIJ5JL53LFcpkiOW0e6FCC2wZA83 Wfsg== 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; bh=dDVs2Scdhf4A9ZqR31Prm/U5Y0rMW1Js53XuISw2dOc=; b=DA0HuzhXW57akvkQU1TzFkpNx2pxHPxg0zSz81BtaHjKQK2i1PrOP+9Guok1ahNvQM 8T8B4PlxzXdQTyP+Du5dOgKWZGAXiiG2gq0C3XuyiFENAlF8pltIfp7oBLL0ABfrW+vc zAx3bhePQgpe9clV+dOlOxEOVmtcXyg56+6pdR5e1xQqtLoWpbAhwIv7dgSDzsM6LZeQ +hhBXzdo6vefZIkhPLAL2a3jiWtE2fVKsJnvzZqmslDExUsCgWpZNZs8QSBbP9kgwKpB hnCvgOv7UqKkRGP4PSYZ4Z43RMpiRdzQr3605zfHUFi5ynXYSOer3tZHSnvEHU3WqUZb 513w== ARC-Authentication-Results: i=1; mx.google.com; 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 z7si4368101jap.105.2021.07.14.16.20.32; Wed, 14 Jul 2021 16:20:43 -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; 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 S234428AbhGNWQS (ORCPT + 99 others); Wed, 14 Jul 2021 18:16:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:50360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231407AbhGNWQS (ORCPT ); Wed, 14 Jul 2021 18:16:18 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 901CC6101B; Wed, 14 Jul 2021 22:13:25 +0000 (UTC) Date: Wed, 14 Jul 2021 18:13:18 -0400 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Ingo Molnar , Andrew Morton , Chuck Lever Subject: Re: [GIT PULL] tracing: Add __string_len() and __assign_str_len() helpers Message-ID: <20210714181318.735a496b@oasis.local.home> In-Reply-To: <20210714175633.3b53346a@oasis.local.home> References: <20210713171143.7784697e@oasis.local.home> <20210714175633.3b53346a@oasis.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Jul 2021 17:56:33 -0400 Steven Rostedt wrote: > That "(len)+1" adds the extra byte for the '0'. Hence, it is similar to: > > dst = kmalloc(len + 1, GFP_KERNEL); > strncpy(dst, src, len); > dst[len] = '\0'; > > Where the requirement is that you want to save len bytes of source into > dst, where len must be at least the size of src. Sorry, that should have read "len must be at most the size of src". That is, the caller knows how big src is, and is telling the trace event that all characters up to "len" exists. -- Steve