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=-3.8 required=3.0 tests=BAYES_00, 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 47691C4741F for ; Sun, 1 Nov 2020 22:13:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF9E5222B9 for ; Sun, 1 Nov 2020 22:13:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727367AbgKAWN4 (ORCPT ); Sun, 1 Nov 2020 17:13:56 -0500 Received: from smtprelay0215.hostedemail.com ([216.40.44.215]:59954 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727009AbgKAWN4 (ORCPT ); Sun, 1 Nov 2020 17:13:56 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id 51BFF100E7B42; Sun, 1 Nov 2020 22:13:55 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: wash01_230fb5d272aa X-Filterd-Recvd-Size: 1888 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Sun, 1 Nov 2020 22:13:53 +0000 (UTC) Message-ID: <2abb3c694107764dea1e118566eb3c6c331404fc.camel@perches.com> Subject: Re: [PATCH 4/5] mm: shmem: Convert shmem_enabled_show to use sysfs_emit_at From: Joe Perches To: Matthew Wilcox , Greg Kroah-Hartman Cc: Hugh Dickins , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Sun, 01 Nov 2020 14:13:52 -0800 In-Reply-To: <20201101220604.GI27442@casper.infradead.org> References: <20201101204834.GF27442@casper.infradead.org> <616b92af9378e9f9697555074bba1e377450477f.camel@perches.com> <20201101211910.GG27442@casper.infradead.org> <20201101220604.GI27442@casper.infradead.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2020-11-01 at 22:06 +0000, Matthew Wilcox wrote: > Oh, ugh, sysfs_emit() should be able to work on a buffer that isn't > page aligned. Greg, how about this? > > +++ b/fs/sysfs/file.c > @@ -722,13 +722,13 @@ int sysfs_emit(char *buf, const char *fmt, ...) >  { >         va_list args; >         int len; > + int start = offset_in_page(buf); I thought of that originally and didn't want to implement it that way as it allows sysfs_emit to be used on non-page aligned buffers. Using two functions makes sure the buf is always page aligned and so buf should never defectively be passed in unaligned.