public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Kyle Tso <kyletso@google.com>
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
Date: Fri, 23 Jun 2023 13:14:42 +0200	[thread overview]
Message-ID: <2023062327-bucked-backrest-c20d@gregkh> (raw)
In-Reply-To: <CAGZ6i=1uD-baR+Tht4+D1oC7O04K4L-RDBdDLSo6gZhNqN=2rg@mail.gmail.com>

On Fri, Jun 23, 2023 at 06:11:00PM +0800, Kyle Tso wrote:
> On Fri, Jun 23, 2023 at 6:06 PM Kyle Tso <kyletso@google.com> wrote:
> >
> > On Fri, Jun 23, 2023 at 3:51 PM Greg KH <gregkh@linuxfoundation.org> 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 :)

  reply	other threads:[~2023-06-23 11:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 15:04 [PATCH 0/3] Some fixes for select_usb_power_delivery Kyle Tso
2023-06-22 15:04 ` [PATCH 1/3] usb: typec: Set port->pd before adding device for typec_port Kyle Tso
2023-06-23  7:50   ` Greg KH
2023-06-23 10:08     ` Kyle Tso
2023-06-22 15:04 ` [PATCH 2/3] usb: typec: Iterate pds array when showing the pd list Kyle Tso
2023-06-22 15:04 ` [PATCH 3/3] usb: typec: Use sysfs_emit_at when concatenating the string Kyle Tso
2023-06-23  7:51   ` Greg KH
2023-06-23 10:06     ` Kyle Tso
2023-06-23 10:11       ` Kyle Tso
2023-06-23 11:14         ` Greg KH [this message]
2023-06-23 14:23           ` Kyle Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2023062327-bucked-backrest-c20d@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=badhri@google.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox