Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12311811rwd; Fri, 23 Jun 2023 04:33:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5AjW26gv/tHffELZa+LmBX3MpQyheQ5gU+sah9bhKUvgxwV97QuAkoV0SrwKkk0rjEu/hF X-Received: by 2002:a92:c08c:0:b0:341:da64:d834 with SMTP id h12-20020a92c08c000000b00341da64d834mr11253738ile.6.1687520037078; Fri, 23 Jun 2023 04:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687520037; cv=none; d=google.com; s=arc-20160816; b=ZMHPERSRoIM5DqE1NE6PA7twyWIoaQxCX8+TKOvL1iOjGb5ZGnMKPqOUm5egzsbYr9 sLhpaT0kDzG3KfnBm7R4Y/CVXryx+WuFNUCcSl25JrOG2YNfu3czTLMOhEl+lzz7+Smq 0+j4XPzePSrifQDPwI99XAHN2mDE3CmW1Hig7SKGVo3NnFEsy0JgGkr4+ixk9iaVpcUq 3prhyKiZw7N4hG08oS3pX6SOcuWtneAoDjNd+S6YZv46b0mWHG9Kh4B5JfLqK/wPFQ7S NoNN2gRixiyGnSSnn93+PsJzLkOwQSonLP87u/Y8hCxHGdgxIaJPMdb9XjoQ8maWyats hkpg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fY2aDjDlfMHL+xgR1gdEwfx/4GV1/GauvkXwVlJ5/k4=; b=CS/WbXnCeT4Vkv+ELkKPAPp1MY9Pw/TXS1G2yBbASdLAISsDa82uO9K2/KgCuRoWrK xpigblz5WXFMYWgrLoxvaGgWTLZFQZ51KPR3KDNUoCbc1KkEHxbsDn4j5qbRUUMM14oK GssFHig9kOd1ukC01Fv4hi3eyk0KU0xbuTXyEhRPoTDmXGNeXthAurXt2DlqHaDxVJVu eqS1UWofGpjToPzFgW0Bwfk0Pv8uONAKSAYizc/GMv0+zdY8Y+8WwVh5/3E7MI6yHbSf nC/6tuSX9/gZzsLW7i3PIyrvf1Yf1Znexo6MJAyii5y04HtbyFZAMK4xeisCyt2ZLnup mM1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fOCpUqB2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x28-20020aa7941c000000b0065dba8cc3a6si1672578pfo.376.2023.06.23.04.33.41; Fri, 23 Jun 2023 04:33:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fOCpUqB2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbjFWLPe (ORCPT + 99 others); Fri, 23 Jun 2023 07:15:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230503AbjFWLPb (ORCPT ); Fri, 23 Jun 2023 07:15:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA5B8273A; Fri, 23 Jun 2023 04:15:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 01C1D61A2B; Fri, 23 Jun 2023 11:14:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FCAFC433C0; Fri, 23 Jun 2023 11:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687518885; bh=xbvC3kjWq1hfL5aAh9tuCG2kEzE43wCvi8FpuV11tSc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fOCpUqB2aSnCuKP8QBkQDlQjh7NtXPhJNVyP9vYqz+j32WRaQvMBK7mEYpM1xKYmU sfe+PSR9DueffCx5tZiN+XPYoHVR81o2tXWCgOn65XdSQpbaGXpQbUT85MisWHCmMZ DKDfUv5CguUE5yS1Nh9CWgq7jTpDjVdVwD6hm12w= Date: Fri, 23 Jun 2023 13:14:42 +0200 From: Greg KH To: Kyle Tso Cc: heikki.krogerus@linux.intel.com, badhri@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] usb: typec: Use sysfs_emit_at when concatenating the string Message-ID: <2023062327-bucked-backrest-c20d@gregkh> References: <20230622150423.3726894-1-kyletso@google.com> <20230622150423.3726894-4-kyletso@google.com> <2023062345-hassle-septic-b8b4@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 23, 2023 at 06:11:00PM +0800, Kyle Tso wrote: > On Fri, Jun 23, 2023 at 6:06 PM Kyle Tso wrote: > > > > On Fri, Jun 23, 2023 at 3:51 PM Greg KH wrote: > > > > > > On Thu, Jun 22, 2023 at 11:04:23PM +0800, Kyle Tso wrote: > > > > The buffer address used in sysfs_emit should be aligned to PAGE_SIZE. > > > > > > Why? Are you getting warnings about this? > > > > > > thanks, > > > > > > greg k-h > > > > Yes, here is the warning. > > > > [ 223.243123] invalid sysfs_emit: buf:00000000eda2d647 > > [ 223.243197] WARNING: CPU: 4 PID: 8860 at fs/sysfs/file.c:735 > > sysfs_emit+0xb0/0xc0 > > [ 223.244335] CPU: 4 PID: 8860 Comm: cat > > [ 223.244363] pstate: 62400005 (nZCv daif +PAN -UAO +TCO -DIT -SSBS BTYPE=--) > > [ 223.244378] pc : sysfs_emit+0xb0/0xc0 > > [ 223.244394] lr : sysfs_emit+0xac/0xc0 > > ... > > [ 223.244560] Call trace: > > [ 223.244568] sysfs_emit+0xb0/0xc0 > > [ 223.244582] select_usb_power_delivery_show+0x134/0x18c > > [ 223.244626] dev_attr_show+0x38/0x74 > > [ 223.244654] sysfs_kf_seq_show+0xb4/0x130 > > [ 223.244668] kernfs_seq_show+0x44/0x54 > > [ 223.244683] seq_read_iter+0x158/0x4ec > > [ 223.244727] kernfs_fop_read_iter+0x68/0x1b0 > > [ 223.244739] vfs_read+0x1d8/0x2b0 > > [ 223.244775] ksys_read+0x78/0xe8 > > > > The warning comes from > > https://elixir.bootlin.com/linux/v6.3.9/source/fs/sysfs/file.c#L734 > > > > if (WARN(!buf || offset_in_page(buf), "invalid sysfs_emit: buf:%p\n", buf)) > > return 0; > > > > Kyle > > BTW, to print the buf address, it should use %pK ... Patches accepted :)