Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp631328pxb; Tue, 1 Feb 2022 07:20:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhx0lsUIo9QTz54t3WkehDlsIuKE95O8zrcOL//MGZCr0uR9rvKk6ilYF1p12cSINv9f1h X-Received: by 2002:a17:906:15c2:: with SMTP id l2mr20256699ejd.477.1643728811794; Tue, 01 Feb 2022 07:20:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643728811; cv=none; d=google.com; s=arc-20160816; b=F2p7ve0lNlWRPgQeS266WjvtcIU6pv1qRWkxfHkHTt5ri28GyKref8etN4hcv09UR2 PRfphK01ljyOEUfYlAEJTIYSzgfMDD6nrYqwTHF9bJRb9oEd6CaJbtZlX+YL1Uqhgg3Z l1V0O3YSzF0BgsOnaxGewppI/eY4AFpwLxdM7g7s9weKLNxXcbP3t7u78CLC1dhMXeMe UZSPwvpgFO3U0tPsu4UvyBuMv7QM9lUP9i6Vb9DQQaj6zeNYyMLsmsZ0EvyDPoYYKlzE 8TKnk84zi9JNRXrUy9uXv8L/mpLWlg1Sxw0E7L6mLwv4PuH8KBGw+u2Wmg0AMSSAJGZU gTIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UKwameRoPfgLHWpBXoqOSY31hKTED2y4WM3/cMREqYQ=; b=BMpJ7vyevs2QERnfLzXjDF8yq6sMyJzd+7cOne8fv3mnCYdulzfaLVTz6hKypIvWDg rxuP+uiGC3vEeBtt6iXafsU0g6FdznaPPzXBHus78Am5QSNaxkLVeX/wxgeHfvKgzA1q 024/NJRJtnWFR66X9Dtijckyc9GsbaStkhYNnCyAUqZicayzjonxLx5SKg/7CiEJwTL/ tkU+aJxJZuT2ZevZoGHLM+38Wo0UMlhoItMQBuXxDWoJdpWbPrMbck0ptcEI62FSFvfX fKOdBeqrCbaOkJnc9qqpvQ+USrVUP3wzDlS+pKYAjTUYbRIEbxMfkqzeif6/qpTR7+nO yU0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ie36z+3J; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sg37si10136791ejc.314.2022.02.01.07.19.44; Tue, 01 Feb 2022 07:20:11 -0800 (PST) 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=@chromium.org header.s=google header.b=ie36z+3J; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357447AbiAaC6t (ORCPT + 99 others); Sun, 30 Jan 2022 21:58:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241493AbiAaC6s (ORCPT ); Sun, 30 Jan 2022 21:58:48 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D33DC061714 for ; Sun, 30 Jan 2022 18:58:48 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id o16-20020a17090aac1000b001b62f629953so9509646pjq.3 for ; Sun, 30 Jan 2022 18:58:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UKwameRoPfgLHWpBXoqOSY31hKTED2y4WM3/cMREqYQ=; b=ie36z+3JbZH6BpcGWoA8u8BouUWN7xsL3fl1f4YoG1CTP82izOviQ8uJeRSWesrmi0 SdWI6A0H7yGOF4A02a4ZCDGnvB8dgzI0l6WNB2l6lcim35Ft20EXinLNlIA2m0HzJZro iWeB2iq9vReukiu+pPL2Qswox9STXWvm1FfDc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UKwameRoPfgLHWpBXoqOSY31hKTED2y4WM3/cMREqYQ=; b=CweuLFtSKAsyVTLAQgdWYLbnqmcauVVQVGdWnHzoXUy8AB6wLGTz8a7NpGbxYeSy/0 Khy2wiwJmQZvMhe+0SMAiq5NMAtZTboKjCLx1DQt0AoeSP/PBN3yQFhS6cOjneJffyD7 dkSv/jqkTO9nP/NYjTmpYQ0br5346sG6VyWi9lYNIlTrBMQV2LnO29dFpanB4lafsOrE Mg3CaZtPifOTV3L/by9a1SD35LottFIGjNHp4IaFos27PuPgkD928DsuPeMZv1xnRTsi xgRnqJtY1M7lXDhQmuBcntJRl1G+TbIGVX30oyw+FxvQvqMfL9ERKrjAtsiKWY/2QSI4 fHKQ== X-Gm-Message-State: AOAM532DkZX6NXPgvuYPRbZ2ua0dQ1JlwQgkTH+iEZAzt93EBvrB0+Lw R4EvJBbtpt6ytrLynxm3ZR2mYg== X-Received: by 2002:a17:90a:ed03:: with SMTP id kq3mr21942288pjb.136.1643597927548; Sun, 30 Jan 2022 18:58:47 -0800 (PST) Received: from google.com ([2401:fa00:8f:203:c6d0:3c7:e220:605c]) by smtp.gmail.com with ESMTPSA id s30sm5169120pfw.63.2022.01.30.18.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 18:58:47 -0800 (PST) Date: Mon, 31 Jan 2022 11:58:41 +0900 From: Sergey Senozhatsky To: Waiman Long Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Ira Weiny , Rafael Aquini Subject: Re: [PATCH v2 2/3] mm/page_owner: Use scnprintf() to avoid excessive buffer overrun check Message-ID: References: <20220129205315.478628-1-longman@redhat.com> <20220129205315.478628-3-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220129205315.478628-3-longman@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (22/01/29 15:53), Waiman Long wrote: > The snprintf() function can return a length greater than the given > input size. That will require a check for buffer overrun after each > invocation of snprintf(). scnprintf(), on the other hand, will never > return a greater length. By using scnprintf() in selected places, we > can avoid some buffer overrun checks except after stack_depot_snprint() > and after the last snprintf(). > > Signed-off-by: Waiman Long Reviewed-by: Sergey Senozhatsky