Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4018538ybz; Mon, 20 Apr 2020 14:00:00 -0700 (PDT) X-Google-Smtp-Source: APiQypKYQ4S+8pj9jvqGx0g3/FsMfg15RBWZhHnP1Y5tg0j+qH1Ooqol4bdExy4oRd83NC3ocSUT X-Received: by 2002:aa7:d504:: with SMTP id y4mr8328589edq.295.1587416400774; Mon, 20 Apr 2020 14:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587416400; cv=none; d=google.com; s=arc-20160816; b=k1E26+x6BMv0xoYziZGfFj2l8pMPgNiC4O1tsW5g+piimU9TPlqf80THNkaLjRdNU7 ejDi7YOCJ+/1wRnGBLMynFNjn2lk5imXXxGvKPb/zwlYcvpHhK27LAOlQqWfFqDogyjB bbCIUOrooVj9RbKUhUkxQN96S4n410OM/iW3meCKFDsfe7gVakoQFy728UBcjsUHmtVr uf3o4/ON/V/pFpddxmxyk2kl25qxDHKEGDKRVcuU3N8mXpmMzBF3VoN0dBGriX/8A1Ac LQq48TCa3iecVKE2dNwyisoW4Om42cq0Vnd/iWzCx17LLrZTWVh+Z0qaXblj4D7xY2zo j8OA== 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:date:subject:cc:to:from :dkim-signature; bh=1QRT1wzQMBmwwO+9Yk8Tpugr8OoDuhlvGMhmG6vAGJg=; b=0H3IIDVb6ntkmv/fzs2ZP7BOu+Q2NyWWnLaqu4jRgLZajBn50a0vryiZvEn2UCjVeB 5NXJOyF0G8WcU72uGpXpjCPeOLEHQB9na58quTcn1wE6CRiMlSrNDcSoJvaU9XXEOvPZ brO3UVyGDzlkd7qnyoV7dZvuEQeE6rK08Be7G6f2WzjnusrvfE0Bg+UGg9nsStsrxny+ JuEMxml0XNBINR5s8jHrzzY/utCT02X6WE4D4A+PNLFkJ63EVqHfg+9dP4XBbngXaGzC op/UcyKZo+OYrZR2rRGYHRlD4aElmxtj+EHAT3I8tseRcejwV0gl+lPLRwsSRTGSt8rc nNHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VErFtc8p; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o18si235007ejr.273.2020.04.20.13.59.37; Mon, 20 Apr 2020 14:00:00 -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=@gmail.com header.s=20161025 header.b=VErFtc8p; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727887AbgDTU6V (ORCPT + 99 others); Mon, 20 Apr 2020 16:58:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727820AbgDTU6S (ORCPT ); Mon, 20 Apr 2020 16:58:18 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31E78C061A0F; Mon, 20 Apr 2020 13:58:18 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id b11so13929852wrs.6; Mon, 20 Apr 2020 13:58:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1QRT1wzQMBmwwO+9Yk8Tpugr8OoDuhlvGMhmG6vAGJg=; b=VErFtc8p5FgVeV8QdilC2z2fbaXoDv1sAJ2HJ6HfBg0NvTE5SxKcxkMi4QjrhWQZGg 06buzM1cahhmxIeYk0841s2YLJugZTpE0Q4S0Y3QVD2dJeH0gT+Es1BaaXpqN9+m+R/3 Ij7ryhVlFwha5TH3Q6E1JOpyXHeF6oGXAPA1ojHZQBIGWeqJsw0vxmLCe6hRYTQMFQb7 iVpcvVq6LHq0Flml+wMu1kDbY/hjxYwIi+DSp3G3fhB5guV+aPOFnDIeZuSfE54a6/xn TJERmfZP4kuyP8EY+6P03MuaJ7dI9w//VylifFrm2sFE4AJjdBmNflscjDjH2gutX40O WqHA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=1QRT1wzQMBmwwO+9Yk8Tpugr8OoDuhlvGMhmG6vAGJg=; b=ka4Lt7gpwVxVQC1tYHWbVid3UqTAuKDWDktoKSUHJeTCSY11lqCzb58+bErllbMtP9 j7BhQnQidr7USDo53+YeoRwRympJFCX02xn6MxNhuFIFSinqiAbv9jVwvYm40zxF4YcY Y+NazAD5OY4QK3ruLrni2Ed5RKJIzqMCqvdNAk/8hRoon9KJxDfXEKX7vgcYkll2M20/ Ekgmr4hf1lEq7gqCV6FevwH1V1ayRxtKgYdvoV3CsRzOBQqUTpQr+oh7BCqntR7Sxy/z Z0nGD3Z0KrAUVy7O3sSVq6fcEBU9RPy4FAWWFHx0dP1s8OWbyqzdm8gTAR6BGG9N5U0t 0xwA== X-Gm-Message-State: AGi0PuanPKiSJGPUZZ3aO72RqmwbyqQFv9qdYk9ZOlAUFopmjkbEXVy6 LOt5KKgKjL3RNLrvK7O3SQ== X-Received: by 2002:adf:91e1:: with SMTP id 88mr21203077wri.67.1587416296986; Mon, 20 Apr 2020 13:58:16 -0700 (PDT) Received: from avx2.telecom.by ([46.53.249.74]) by smtp.gmail.com with ESMTPSA id m8sm863069wrx.54.2020.04.20.13.58.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 13:58:16 -0700 (PDT) From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: adobriyan@gmail.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, pmladek@suse.com, rostedt@goodmis.org, sergey.senozhatsky@gmail.com, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk Subject: [PATCH 10/15] print_integer, proc: rewrite /proc/*/fd via print_integer() Date: Mon, 20 Apr 2020 23:57:38 +0300 Message-Id: <20200420205743.19964-10-adobriyan@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200420205743.19964-1-adobriyan@gmail.com> References: <20200420205743.19964-1-adobriyan@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Alexey Dobriyan --- fs/proc/fd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/proc/fd.c b/fs/proc/fd.c index e098302b5101..059a3404c785 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c @@ -247,8 +247,8 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx, fd++, ctx->pos++) { struct file *f; struct fd_data data; - char name[10 + 1]; - unsigned int len; + char buf[10]; + char *p = buf + sizeof(buf); f = fcheck_files(files, fd); if (!f) @@ -257,9 +257,9 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx, rcu_read_unlock(); data.fd = fd; - len = snprintf(name, sizeof(name), "%u", fd); + p = _print_integer_u32(p, fd); if (!proc_fill_cache(file, ctx, - name, len, instantiate, tsk, + p, buf + sizeof(buf) - p, instantiate, tsk, &data)) goto out_fd_loop; cond_resched(); -- 2.24.1