From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 945AEC41604 for ; Wed, 7 Oct 2020 07:24:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C0F320797 for ; Wed, 7 Oct 2020 07:24:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NUn714Dv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C0F320797 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 93895900008; Wed, 7 Oct 2020 03:24:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E829900007; Wed, 7 Oct 2020 03:24:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82635900008; Wed, 7 Oct 2020 03:24:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0079.hostedemail.com [216.40.44.79]) by kanga.kvack.org (Postfix) with ESMTP id 5618F900007 for ; Wed, 7 Oct 2020 03:24:45 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E76EB3622 for ; Wed, 7 Oct 2020 07:24:44 +0000 (UTC) X-FDA: 77344292088.11.sea12_4f144d2271cd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id D323C1803A191 for ; Wed, 7 Oct 2020 07:16:04 +0000 (UTC) X-HE-Tag: sea12_4f144d2271cd X-Filterd-Recvd-Size: 3644 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Wed, 7 Oct 2020 07:16:04 +0000 (UTC) Received: by mail-pf1-f172.google.com with SMTP id q123so837872pfb.0 for ; Wed, 07 Oct 2020 00:16:04 -0700 (PDT) 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=VAMHHTsEYOhpC7nwdJdZa5VIDvqttOjzyBVmzNIOcqI=; b=NUn714DvJvDMQIdzlP8THy5CMxCa8J+YmM9WyI5X6ok04Y0zsgkhEjtYuRwrfk+lrR VgOoiDHOgKgr3TNlgXUX/FvV61O4X7OCSuzIflNRAUj9iNh1vRXH0LvG9ZlRsnIXVg/P G9uO2UMyp0dpxSkQp/vdtVbxq1PjDXqMdF/bw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VAMHHTsEYOhpC7nwdJdZa5VIDvqttOjzyBVmzNIOcqI=; b=Vl99mvb6Ko09JGcdLYq0037LH+v9DJwxO7Cpgh4KwjIF8bgyyWT5El0HiIJJfIS82K h2TOHFGbpFuyuytV60rABtk2fdsBi8y4L50jcfUKFS786q0aYtDY6CT3mJ2yaoh8MzO0 ZOyVtIVesbG5uCV59r3MQx5ZgO3zOjH+qaWgWc5ZZ14cv6JROMUErmxDpGO3Y5A5jM0K GzyIitdLSr1R8jp4rWMDM4M3oUzPcNNjjvHI2e8DVhyaqqfr5DJN9OiGw2pxyUadmJjk 2rUAL0D+iKe6f1OWJ9YQnKvA4gNAF5IgVjx8ngp5d++tzNLqHtmN6KWYByZvrMQmHFIh NXVw== X-Gm-Message-State: AOAM530M6mTOjtsGtmugMeBQdnPQl8WO0cyKd4lhiPt4McxrmTALRwi9 7CzdImGI+AiDdrZeiYX4ctl32w== X-Google-Smtp-Source: ABdhPJwIp4NcTjnEGHi7P5Yx9AJ6lFfuLzmNSrv+L/Ys6tbmVmq7YF2tTod4pFVVLpUUX5cujebIcw== X-Received: by 2002:aa7:8d15:0:b029:142:2501:39fe with SMTP id j21-20020aa78d150000b0290142250139femr1667154pfe.77.1602054963311; Wed, 07 Oct 2020 00:16:03 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h9sm1565834pfc.28.2020.10.07.00.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 00:16:02 -0700 (PDT) Date: Wed, 7 Oct 2020 00:16:01 -0700 From: Kees Cook To: Joe Perches Cc: Andrew Morton , Mike Kravetz , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , linux-mm@kvack.org, linux-kernel , Greg KH Subject: Re: [PATCH -next] mm: Use sysfs_emit functions not sprintf Message-ID: <202010070014.76AA763CE@keescook> References: <8a0d4fc9a4e372b125249b186689f247312d4387.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8a0d4fc9a4e372b125249b186689f247312d4387.camel@perches.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Oct 06, 2020 at 09:28:17AM -0700, Joe Perches wrote: > Convert the various uses of sprintf/snprintf/scnprintf to > format sysfs output to sysfs_emit and sysfs_emit_at to make > clear the output is sysfs related and to avoid any possible > buffer overrun of the PAGE_SIZE buffer. > > Done with cocci scripts and some typing. Can you include the cocci script in the commit log? It might be nicer to split the "manual" changes from the cocci changes, as that makes review much easier too. Regardless, yes, I'm a fan of switching these all around to sysfs_emit*(). :) Thanks! -- Kees Cook