Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6442035imm; Mon, 27 Aug 2018 16:17:30 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdan4wHcVICGUhJJ0zxZMIjBV550efaImtN9Df90wPhsLbD6gCcb9Nq8zubFQdLrXV4fSaHE X-Received: by 2002:a63:f244:: with SMTP id d4-v6mr13873561pgk.2.1535411850026; Mon, 27 Aug 2018 16:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535411849; cv=none; d=google.com; s=arc-20160816; b=tCc/taWKBqiRi5Krki/97W0xisNahOZ431EDZ1onJMy9Op4rR/IrVUIGkDdVQBfHIy 1kFrl8SVFKM15a666S0bKwh8T5xGAL8O2C9SEg1mclJqgn9d/+zHpUE4HKeRub3nOL5G jmZCpWo7ybEQTeuhzQxv5Iydia0ivV8jcPdBiihvtAMhldOdxQze2x6DMAN/mSwfFBrC STb1xskiHxX/c3xSp3iD3W1t/VYZMkAAfcuRl0+U/nQQ7eTlMsmh/Y+F0ZjqoTSiuSTz mINbxzTisp6Xx/N1peNk11fSgFNxiGvfs08jiz7tRHaYqPJ4nWjM7HTq9LwpDFJTYPXz Z3PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=B6S1YfaalLQeOoG1AXl7LMHN6ZItLjkjAXpv/5xk+0A=; b=y8r2X+TYSIm7AOECMurf/xhdDG94GzFVSqvJ4Zo4rwAAsrqkyiXO65xPM0AQvlUlfE EDX0GGIq5kGjmIElF2EffpiNHZWaOB8ERWkWxyui/hKQncZefIlmqHvxGolY4S8YSykz 5wYvVn+T4RtthLpKyzJFZzSRPF48cczwLCLmJ/Kqn6snNeBOqSB44l07293iEa7KC1rt mR/oXEhvNYCudoZht6RViJmCVyrb6PxJ48kb9qkuhAZ/tMAj/YD+Q+49UOXC4MxOUa4+ NztaL9TVfU82RHJFasQST8+j8nwdkt6wiDsgAr6+idatpPdJ4MmHNfdQgO/rFj3ESpSi aWjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bWpggvOo; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l186-v6si541657pgl.182.2018.08.27.16.17.14; Mon, 27 Aug 2018 16:17:29 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bWpggvOo; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727678AbeH1DE3 (ORCPT + 99 others); Mon, 27 Aug 2018 23:04:29 -0400 Received: from mail-ed1-f53.google.com ([209.85.208.53]:43278 "EHLO mail-ed1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727610AbeH1DE2 (ORCPT ); Mon, 27 Aug 2018 23:04:28 -0400 Received: by mail-ed1-f53.google.com with SMTP id z27-v6so432832edb.10 for ; Mon, 27 Aug 2018 16:15:42 -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; bh=B6S1YfaalLQeOoG1AXl7LMHN6ZItLjkjAXpv/5xk+0A=; b=bWpggvOo2b3yJbU+IGn980gmzktuyLs2yvC3yFeJxVbmfDDsFbvN9XFBC2lCSAoCct Dofv0nlucHgBXhIr/DEXAAbjZad+JmJvB95F/DPs0hLTtxF7k6YqYxqO8NFllHzpHWBb UbA5PlDEG+PkER7BJUynImU9luiUv0be/MFIyknjMbYlsFEsPCq9NRTaNVnhoWCXRHIM INJv+95kUWHVzIbbmW8JW88IjEK4t3A8OtDA5ErwvRnET0++y+DkaEkKX5p749HgETJ4 dpsUc6h5+wEgMLpCzfxjzzn/p/vMCAWFGc3l2fySvi7ShJnTXf6BHE9DEQ2e0rbOPsw3 31oQ== 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; bh=B6S1YfaalLQeOoG1AXl7LMHN6ZItLjkjAXpv/5xk+0A=; b=Kmhk5k+3g9Tejp9lWipsHh29PVkuWGenXLYm0v+B4tjdXFKYP++TdOn8enP3G6xpXN P6FijxDtpRe+WRgXMyz+aitLgQPy7ujZz+LAv9D7UomEtBSXYb0C9l50ZValIu3cvgHf eYC2B7rW54BydhDfWyKSGaOwCwlTSmLv0lvAXrILTatejjAic9yefYwXtF+F8s0ajbQT sPSn3FVSnK7FiYBlrzdtJP1TYmuC6xM4oyxjkQArYX1q1QDeqKWgzEEEe2S/fuNJX4Bs Eu32iLLKXww3c+LkGgGYza87tFE1IWk+70Gl8uUjCTL5ww4oxbghU7Pp0HMjO3kPJas8 73tA== X-Gm-Message-State: APzg51BYTqNSubgCuNw4Js0aayaRY3a6Ye+S2QHL40pP3KFH7HuwhRyr z9G4hOGfg4XhbEf8Lj8yGw== X-Received: by 2002:a50:8e09:: with SMTP id 9-v6mr18544251edw.101.1535411741810; Mon, 27 Aug 2018 16:15:41 -0700 (PDT) Received: from localhost.localdomain (nat4-minsk-pool-46-53-177-92.telecom.by. [46.53.177.92]) by smtp.gmail.com with ESMTPSA id u3-v6sm173918edo.44.2018.08.27.16.15.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 16:15:41 -0700 (PDT) From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan Subject: [PATCH 11/13] proc: readdir /proc/*/task Date: Tue, 28 Aug 2018 02:15:01 +0300 Message-Id: <20180827231503.26899-11-adobriyan@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180827231503.26899-1-adobriyan@gmail.com> References: <20180827231503.26899-1-adobriyan@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --- fs/proc/base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index 33f444721965..668e465c86b3 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3549,11 +3549,11 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx) for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns); task; task = next_tid(task), ctx->pos++) { - char name[10 + 1]; - unsigned int len; + char name[10], *p = name + sizeof(name); + tid = task_pid_nr_ns(task, ns); - len = snprintf(name, sizeof(name), "%u", tid); - if (!proc_fill_cache(file, ctx, name, len, + p = _print_integer_u32(p, tid); + if (!proc_fill_cache(file, ctx, p, name + sizeof(name) - p, proc_task_instantiate, task, NULL)) { /* returning this tgid failed, save it as the first * pid for the next readir call */ -- 2.16.4