Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp868225pxj; Fri, 28 May 2021 18:54:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzacXU+imPUmR9p/N/Ik76XB4y0zQiqhhqc9omNG0sy1iIGv/ZgDlCGHEwruFfirqeqT1CN X-Received: by 2002:a17:907:72c3:: with SMTP id du3mr11772086ejc.194.1622253297812; Fri, 28 May 2021 18:54:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622253297; cv=none; d=google.com; s=arc-20160816; b=LbXLh1pF9rAMoH6CKN6x1O0fxBf72+t24CubNWdLSsi8QlFPNnWgaAYLt7c3lONlzr JQQixtcAMM7qSB/zqrVGEZiS15qUZKTgRTk8gjp69tF3EK4j1jTQrI1QVU+RXHaRXWUU OzpLLPkfpZVaShWuKnYGiryJ1dudPSIwnz3BlsCC/G3r2REgMYVhczkaQnoEopETPNmp 0eq6Sk5QcK6yOjDEh3MR+s0XiYfcNeLHfvCS0BkC9p8V3Vv0Isv4NTP+2EDVj887cZBY TQK87qdMWmpka0ZswKi/VinMhCtNvlhqiMg7YkijmddejUE1D7WSH4fhMHRIJjaSO8N6 TXog== 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=4idv9rjQXRyGWBDNS5D5VxgHvt/9svzDTOVDa76scuQ=; b=SpsK3FcZ/Qc2u8J97rliQt7FvxAQleB51lQrH5JDbEvy0TgaGUU6+jTWbH8yZMK9dv Wc7I0rj6yQI7epWc6iXbuuXhc6wa4HkzTyE3BmXm9SpUijjI/T5G8UPhJdAgAzmlj3my +rz346tGdgR1B0NZffkn0AjXYHnLRmmuSFseq9K+y5npHVP1HD99TPJc5ipdwLqxGKFL oi63ii0nhy7pGm9L6EMXr+zOSUmeW0SJbPk8Isi03lc+e+xwMwvWTpt2yXuxgY6sbBbP UXIoojEX3nQHJM19oF9kHtlAgMqtgFWWXZEIXcrbXdfW5ltgot90GRfHR7DEyCOxYpAh +dUg== 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 b6si6425414eja.92.2021.05.28.18.54.33; Fri, 28 May 2021 18:54:57 -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 S229559AbhE2BxI (ORCPT + 99 others); Fri, 28 May 2021 21:53:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:49772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbhE2BxI (ORCPT ); Fri, 28 May 2021 21:53:08 -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 206CF6127C; Sat, 29 May 2021 01:51:32 +0000 (UTC) Date: Fri, 28 May 2021 21:51:30 -0400 From: Steven Rostedt To: Dietmar Eggemann Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Greg Kroah-Hartman , Valentin Schneider , linux-kernel@vger.kernel.org Subject: Re: [PATCH] debugfs: Fix debugfs_read_file_str() Message-ID: <20210528215130.19523600@oasis.local.home> In-Reply-To: <20210527091105.258457-1-dietmar.eggemann@arm.com> References: <20210527091105.258457-1-dietmar.eggemann@arm.com> 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 Thu, 27 May 2021 11:11:05 +0200 Dietmar Eggemann wrote: > +++ b/fs/debugfs/file.c > @@ -893,7 +893,7 @@ ssize_t debugfs_read_file_str(struct file *file, char __user *user_buf, > > copy[copy_len] = '\n'; > > - ret = simple_read_from_buffer(user_buf, count, ppos, copy, copy_len); > + ret = simple_read_from_buffer(user_buf, count, ppos, copy, len); > kfree(copy); As we have: len = strlen(str) + 1; [..] copy_len = strscpy(copy, str, len); I can't think of any situation that len is not equal to copy_len + 1. :-/ Anyway, either "len" or "copy_len + 1" would work. Reviewed-by: Steven Rostedt (VMware) -- Steve