Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2773867imb; Mon, 4 Mar 2019 13:57:37 -0800 (PST) X-Google-Smtp-Source: APXvYqySTdXf4zDc7s6KsCpmDMeIlEB3pAD7O19WRGCk/QvWr65wEaq+i+ZUG7Q+B3ZaSVnYER8l X-Received: by 2002:a17:902:e711:: with SMTP id co17mr22209361plb.171.1551736657670; Mon, 04 Mar 2019 13:57:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551736657; cv=none; d=google.com; s=arc-20160816; b=FIUy3Z8PIhFMrl/JGQCpDvSnw2t3HzgacAbHXkU4ofVTHb7sOQEp2V7lx8hd2XyDa7 wSOaILZv620WhpFzoU/YdmbKvctCA0LsMJhvjFJu1XWgXaD4UjYfJmB9u4K3SrPJ8wxs gfEaLSyvdCkIRjZIk6npDGCA3302Dt5MMNc8taTqJJccnjDT4okWyF670XBphHuIlgbv O0pHB2yVzIcBQOSBg0DImrl3DIsrpfxbOuco5cV8jhp2yH6vSHQSdkgJunngvT+OkF5j XbGtbwj/IVznJInV6yzsB2XfE5wBOQh/JyYt8Hr62kjxpNvKhRgk1D+GXZimDUvI+ixL A8Ww== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=gVadKlOCvU7B4e8/y0UTn+hqjkLB4PlwcD5NN6NaGv8=; b=PxcL4p91A8Niv6W0oxD9kSpNCxC7WSBTbsNTADdcFoA+MJEc1fiw0WHqWDDRZgeXVi wIAhsprNH+16mxtE6a5nWEQWbpdI/FmechgAZ9n45feqGTpvqrMEZZhlZnwD7GKvyjZv KdoEMDK0aW0HrlOtBhLBpQnBcGr0qAhcqJVdAMIfiI5pje89h2124c8+COa1G7bmOH9l g3HYMbf/28MEjTPwa4OfmS3DtNBRDs8isQT2QCOIj+PgpPcFffSbQ4rxFKLEo0ifJV+h FB5BEmPKKD8z4YyNPvLy4qwr1DQrFchSkWRW8VzlN/QCdwi4rpkUP3S2EvEnrq6+95xy MMOg== 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 p61si6614414plb.224.2019.03.04.13.57.22; Mon, 04 Mar 2019 13:57:37 -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 S1726412AbfCDV44 (ORCPT + 99 others); Mon, 4 Mar 2019 16:56:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:53824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726076AbfCDV44 (ORCPT ); Mon, 4 Mar 2019 16:56:56 -0500 Received: from gandalf.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 DEF5D206B6; Mon, 4 Mar 2019 21:56:54 +0000 (UTC) Date: Mon, 4 Mar 2019 16:56:53 -0500 From: Steven Rostedt To: Tom Zanussi Cc: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Tom Zanussi , Namhyung Kim Subject: Re: [PATCH 2/2] tracing: Use strncpy instead of memcpy for string keys in hist triggers Message-ID: <20190304165653.17699f9f@gandalf.local.home> In-Reply-To: <20190304165000.0ce0fbdd@gandalf.local.home> References: <50c35ae1267d64eee975b8125e151e600071d4dc.1549309756.git.tom.zanussi@linux.intel.com> <20190304165000.0ce0fbdd@gandalf.local.home> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 4 Mar 2019 16:50:00 -0500 Steven Rostedt wrote: > > +++ b/kernel/trace/trace_events_hist.c > > @@ -4695,9 +4695,10 @@ static inline void add_to_key(char *compound_key, void *key, > > /* ensure NULL-termination */ > > if (size > key_field->size - 1) > > size = key_field->size - 1; > > - } > > > > - memcpy(compound_key + key_field->offset, key, size); > > + strncpy(compound_key + key_field->offset, (char *)key, size); > > + } else > > + memcpy(compound_key + key_field->offset, key, size); > > } > > > > Shouldn't we use strncpy() in save_comm() too. Feels safer. Note, if that is changed, it can be another patch. This one is fine as is. I just was looking at other use cases of memcpy() in that file. -- Steve