linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions
@ 2020-10-08  2:36 Joe Perches
  2020-10-08  5:41 ` Leon Romanovsky
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Joe Perches @ 2020-10-08  2:36 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe, linux-rdma, target-devel; +Cc: linux-kernel

A recent commit added a sysfs_emit and sysfs_emit_at to allow various
sysfs show functions to ensure that the PAGE_SIZE buffer argument is
never overrun and always NUL terminated.

Convert the RDMA/InfiniBand subsystem to use these new functions.

The first 2 patches exclusively used coccinelle to convert uses.
The third and fourth patches were done manually.

Compiled allyesconfig and defconfig with all infiniband options selected
no warnings, but untested, no hardward

Overall object size is reduced

total size: allyesconfig x86-64
new: 8364003	1680968	 131520	10176491 9b47eb	(TOTALS)
old: 8365883	1681032	 131520	10178435 9b4f83	(TOTALS)

total size: defconfig x86-64 with all infiniband selected
new; 1359153	 131228	   1910  1492291 16c543	(TOTALS)
old: 1359422	 131228	   1910  1492560 16c650	(TOTALS)

Joe Perches (4):
  RDMA: Convert sysfs device * show functions to use sysfs_emit()
  RDMA: Convert sysfs kobject * show functions to use sysfs_emit()
  RDMA: manual changes for sysfs_emit and neatening
  RDMA: Convert various random sprintf sysfs _show uses to sysfs_emit

 drivers/infiniband/core/cm.c                  |   4 +-
 drivers/infiniband/core/cma_configfs.c        |   4 +-
 drivers/infiniband/core/sysfs.c               | 155 ++++++++++--------
 drivers/infiniband/core/ucma.c                |   2 +-
 drivers/infiniband/core/user_mad.c            |   6 +-
 drivers/infiniband/core/uverbs_main.c         |   4 +-
 drivers/infiniband/hw/bnxt_re/main.c          |   4 +-
 drivers/infiniband/hw/cxgb4/provider.c        |  13 +-
 drivers/infiniband/hw/hfi1/sysfs.c            |  62 ++++---
 drivers/infiniband/hw/i40iw/i40iw_verbs.c     |   6 +-
 drivers/infiniband/hw/mlx4/main.c             |   9 +-
 drivers/infiniband/hw/mlx4/mcg.c              |  82 +++++----
 drivers/infiniband/hw/mlx4/sysfs.c            |  70 ++++----
 drivers/infiniband/hw/mlx5/main.c             |  13 +-
 drivers/infiniband/hw/mthca/mthca_provider.c  |  33 ++--
 drivers/infiniband/hw/ocrdma/ocrdma_main.c    |   4 +-
 drivers/infiniband/hw/qedr/main.c             |  10 +-
 drivers/infiniband/hw/qib/qib_sysfs.c         |  91 +++++-----
 drivers/infiniband/hw/usnic/usnic_ib_sysfs.c  | 104 +++++-------
 .../infiniband/hw/vmw_pvrdma/pvrdma_main.c    |   6 +-
 drivers/infiniband/sw/rxe/rxe_verbs.c         |   2 +-
 drivers/infiniband/ulp/ipoib/ipoib_cm.c       |   4 +-
 drivers/infiniband/ulp/ipoib/ipoib_main.c     |   7 +-
 drivers/infiniband/ulp/ipoib/ipoib_vlan.c     |   2 +-
 drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c  |  60 +++----
 drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c  |  20 +--
 drivers/infiniband/ulp/srp/ib_srp.c           |  49 +++---
 drivers/infiniband/ulp/srpt/ib_srpt.c         |  14 +-
 28 files changed, 423 insertions(+), 417 deletions(-)

-- 
2.26.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions
  2020-10-08  2:36 [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions Joe Perches
@ 2020-10-08  5:41 ` Leon Romanovsky
  2020-10-08  5:52   ` Joe Perches
  2020-10-15  5:29   ` Joe Perches
  2020-10-26 22:54 ` Jason Gunthorpe
  2020-10-28 18:27 ` Jason Gunthorpe
  2 siblings, 2 replies; 7+ messages in thread
From: Leon Romanovsky @ 2020-10-08  5:41 UTC (permalink / raw)
  To: Joe Perches
  Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, target-devel, linux-kernel

On Wed, Oct 07, 2020 at 07:36:23PM -0700, Joe Perches wrote:
> A recent commit added a sysfs_emit and sysfs_emit_at to allow various
> sysfs show functions to ensure that the PAGE_SIZE buffer argument is
> never overrun and always NUL terminated.

Unfortunately but the sysfs_emit commit is not in rdma-next tree yet.

Thanks

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions
  2020-10-08  5:41 ` Leon Romanovsky
@ 2020-10-08  5:52   ` Joe Perches
  2020-10-08  7:02     ` Leon Romanovsky
  2020-10-15  5:29   ` Joe Perches
  1 sibling, 1 reply; 7+ messages in thread
From: Joe Perches @ 2020-10-08  5:52 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, target-devel, linux-kernel

On Thu, 2020-10-08 at 08:41 +0300, Leon Romanovsky wrote:
> On Wed, Oct 07, 2020 at 07:36:23PM -0700, Joe Perches wrote:
> > A recent commit added a sysfs_emit and sysfs_emit_at to allow various
> > sysfs show functions to ensure that the PAGE_SIZE buffer argument is
> > never overrun and always NUL terminated.
> 
> Unfortunately but the sysfs_emit commit is not in rdma-next tree yet.

Likely it'll still apply fairly well when the sysfs_emit commit is...



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions
  2020-10-08  5:52   ` Joe Perches
@ 2020-10-08  7:02     ` Leon Romanovsky
  0 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2020-10-08  7:02 UTC (permalink / raw)
  To: Joe Perches
  Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, target-devel, linux-kernel

On Wed, Oct 07, 2020 at 10:52:15PM -0700, Joe Perches wrote:
> On Thu, 2020-10-08 at 08:41 +0300, Leon Romanovsky wrote:
> > On Wed, Oct 07, 2020 at 07:36:23PM -0700, Joe Perches wrote:
> > > A recent commit added a sysfs_emit and sysfs_emit_at to allow various
> > > sysfs show functions to ensure that the PAGE_SIZE buffer argument is
> > > never overrun and always NUL terminated.
> >
> > Unfortunately but the sysfs_emit commit is not in rdma-next tree yet.
>
> Likely it'll still apply fairly well when the sysfs_emit commit is...

Of course, we just can't take it yet and test it in automatic way like
we are doing now.

Thanks

>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions
  2020-10-08  5:41 ` Leon Romanovsky
  2020-10-08  5:52   ` Joe Perches
@ 2020-10-15  5:29   ` Joe Perches
  1 sibling, 0 replies; 7+ messages in thread
From: Joe Perches @ 2020-10-15  5:29 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, target-devel, linux-kernel

On Thu, 2020-10-08 at 08:41 +0300, Leon Romanovsky wrote:
> On Wed, Oct 07, 2020 at 07:36:23PM -0700, Joe Perches wrote:
> > A recent commit added a sysfs_emit and sysfs_emit_at to allow various
> > sysfs show functions to ensure that the PAGE_SIZE buffer argument is
> > never overrun and always NUL terminated.
> 
> Unfortunately but the sysfs_emit commit is not in rdma-next tree yet.

It is in Linus' tree now.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions
  2020-10-08  2:36 [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions Joe Perches
  2020-10-08  5:41 ` Leon Romanovsky
@ 2020-10-26 22:54 ` Jason Gunthorpe
  2020-10-28 18:27 ` Jason Gunthorpe
  2 siblings, 0 replies; 7+ messages in thread
From: Jason Gunthorpe @ 2020-10-26 22:54 UTC (permalink / raw)
  To: Joe Perches; +Cc: Doug Ledford, linux-rdma, target-devel, linux-kernel

On Wed, Oct 07, 2020 at 07:36:23PM -0700, Joe Perches wrote:
> A recent commit added a sysfs_emit and sysfs_emit_at to allow various
> sysfs show functions to ensure that the PAGE_SIZE buffer argument is
> never overrun and always NUL terminated.
> 
> Convert the RDMA/InfiniBand subsystem to use these new functions.
> 
> The first 2 patches exclusively used coccinelle to convert uses.
> The third and fourth patches were done manually.
> 
> Compiled allyesconfig and defconfig with all infiniband options selected
> no warnings, but untested, no hardward
> 
> Overall object size is reduced
> 
> total size: allyesconfig x86-64
> new: 8364003	1680968	 131520	10176491 9b47eb	(TOTALS)
> old: 8365883	1681032	 131520	10178435 9b4f83	(TOTALS)
> 
> total size: defconfig x86-64 with all infiniband selected
> new; 1359153	 131228	   1910  1492291 16c543	(TOTALS)
> old: 1359422	 131228	   1910  1492560 16c650	(TOTALS)
> 
> Joe Perches (4):
>   RDMA: Convert sysfs device * show functions to use sysfs_emit()
>   RDMA: Convert sysfs kobject * show functions to use sysfs_emit()

First two applied to for-next

>   RDMA: manual changes for sysfs_emit and neatening
>   RDMA: Convert various random sprintf sysfs _show uses to sysfs_emit

Will probably do these two later this week/next

Thanks,
Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions
  2020-10-08  2:36 [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions Joe Perches
  2020-10-08  5:41 ` Leon Romanovsky
  2020-10-26 22:54 ` Jason Gunthorpe
@ 2020-10-28 18:27 ` Jason Gunthorpe
  2 siblings, 0 replies; 7+ messages in thread
From: Jason Gunthorpe @ 2020-10-28 18:27 UTC (permalink / raw)
  To: Joe Perches; +Cc: Doug Ledford, linux-rdma, target-devel, linux-kernel

On Wed, Oct 07, 2020 at 07:36:23PM -0700, Joe Perches wrote:
> Joe Perches (4):
>   RDMA: manual changes for sysfs_emit and neatening
>   RDMA: Convert various random sprintf sysfs _show uses to sysfs_emit

Applied to rdma for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-10-28 22:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08  2:36 [PATCH-next 0/4] RDMA: sprintf to sysfs_emit conversions Joe Perches
2020-10-08  5:41 ` Leon Romanovsky
2020-10-08  5:52   ` Joe Perches
2020-10-08  7:02     ` Leon Romanovsky
2020-10-15  5:29   ` Joe Perches
2020-10-26 22:54 ` Jason Gunthorpe
2020-10-28 18:27 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).