Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1467177pxf; Fri, 26 Mar 2021 08:15:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVuYkrwAbEynGKra2smr4lxL2hsX4Lc8KW89sgntDPs25DRItPo3QVgEM3Bwj3+ZKh2aDf X-Received: by 2002:a17:906:13ce:: with SMTP id g14mr16048531ejc.378.1616771759248; Fri, 26 Mar 2021 08:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771759; cv=none; d=google.com; s=arc-20160816; b=Q/Hgx+qvU5qR7YhO8fXnbfbGqiZE6DzHrCvYedRp4VoW1benkvahojdeBrzqgE4kBV nr3jDs+DybPeLrSa01Q1mJnSZjRWB1brgtU6cDzV45UzQPp8/07m22T1mqXxLPZf/chZ E/MluHJpDEeGy/1gkUBrpac42IUIYgIZi+jCOgtqEu36bW3VAwWW/o97t8jOatAHZZ36 LTt5UFJf/tCpIa+9+rjMbuEhZvnrhaDJCOVmqSm/0+Y9Q82XyVnK4htJEfgykv7kSYdu urQyI0i/DqNQHDgytGMhTyYAXj80rnP0kfu0xXo3E5EJ1SDhC1rAM41n42t3ASOLiJDm HL6w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=xNBOvxce4K4wBx+3sqJnAcmfi681Xs2rjZl0yu+GJDk=; b=y191CFvfOwPcLFmLiMPQ+tjSBfMZ7i+RfGT6QPkK6+eq6TiNWpK25HWb2wXkXFCmOC EcBvLFxGQ0CE/70oH6/V5FjCk55rMO37/B3NA+cEt3AyZctRvO+R5rgpzMP2mWEkNz6k xiuWLX4J7Dzm9I+bvyJ0nQWUDVOVOo9nhPn1RX128W+rFE/pBAJkWz1mB5Fq7rxcPSy5 TzpQYKBOK42YelYqCBRGN88qa5dllFa5HRexUc8YgpalCgJxDi/rjdDTr4n6DqurFA81 9lyoMFgKzXWubhvAWTggiTWWP2zjYTbghlCts7a5xF2PpByA9TiHFcInPxafTVIXcOlB 0OHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=djyYbpuA; 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 ay3si7192883edb.106.2021.03.26.08.15.37; Fri, 26 Mar 2021 08:15:59 -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=djyYbpuA; 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 S230330AbhCZPOk (ORCPT + 99 others); Fri, 26 Mar 2021 11:14:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230445AbhCZPOT (ORCPT ); Fri, 26 Mar 2021 11:14:19 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0D9BC0613AA for ; Fri, 26 Mar 2021 08:14:18 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id ce10so8946121ejb.6 for ; Fri, 26 Mar 2021 08:14:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xNBOvxce4K4wBx+3sqJnAcmfi681Xs2rjZl0yu+GJDk=; b=djyYbpuAilDLPjvYIPPbNxtcKD3imP/sqI2p4Bi/GMmciAYyKGLq4Uulj25hzPahlk bScPDwt0ntdlwQmVqsWdwjxr367iZsgPFOq/LABi9qYTlOiMJfk7bb1VgiAbs0CqA4ym jWSaE6aBJT/CwZHxhn7fiBYdfrhYXyXYymEzc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xNBOvxce4K4wBx+3sqJnAcmfi681Xs2rjZl0yu+GJDk=; b=FAztFIWcZx0JdqkBG1GNennznQmAm7JI0NuSn8k3AmPTqebymnfpEo8kD8Zp5KP6gx 5HC2sp7VKB1/dBuVPbS85ioQWUQGGiJVYtSWErQeAsaNPqllevS6Kwexxdvk6EIg4J5X 1k7RQA95s8uIfnBVEguOwg5zWRVB0c3thg5z7dKo8GOC20rGrwaU1PSdD/E2JbGBfXPf Eozp5HYJa5wMH9q+YyKv0Qh/jy/puBQZ5zGMmEbKawPn3GxyRfzXcd+jGBsEDmTq1rdX Hxa6FWr7388+4ZLGLU69R1C/liww6O/RqmeBFL5Q5P0sXYCBY0qvLcWxIBtpecmPrmVm DAgw== X-Gm-Message-State: AOAM532U9dpPkduUeAluZ5+wdl3IkstfeX8KoJl/GnPxbzuSrLsJhEpj yFKc4r8PI0CwJDN3/zc9Rjn7sQ== X-Received: by 2002:a17:906:2b46:: with SMTP id b6mr15752493ejg.521.1616771657468; Fri, 26 Mar 2021 08:14:17 -0700 (PDT) Received: from prevas-ravi.prevas.se ([80.208.71.248]) by smtp.gmail.com with ESMTPSA id g7sm3967626ejw.51.2021.03.26.08.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:14:16 -0700 (PDT) From: Rasmus Villemoes To: Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: Peter Zijlstra , Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: [PATCH] debugfs: drop pointless nul-termination in debugfs_read_file_bool() Date: Fri, 26 Mar 2021 16:14:11 +0100 Message-Id: <20210326151411.732220-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org simple_read_from_buffer() doesn't care about any bytes in the buffer beyond "available". Making the buffer nul-terminated is therefore completely pointless. Signed-off-by: Rasmus Villemoes --- fs/debugfs/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 686e0ad28788..9979d981e9be 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -773,7 +773,7 @@ EXPORT_SYMBOL_GPL(debugfs_create_atomic_t); ssize_t debugfs_read_file_bool(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - char buf[3]; + char buf[2]; bool val; int r; struct dentry *dentry = F_DENTRY(file); @@ -789,7 +789,6 @@ ssize_t debugfs_read_file_bool(struct file *file, char __user *user_buf, else buf[0] = 'N'; buf[1] = '\n'; - buf[2] = 0x00; return simple_read_from_buffer(user_buf, count, ppos, buf, 2); } EXPORT_SYMBOL_GPL(debugfs_read_file_bool); -- 2.29.2