mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Jakub Kicinski <kuba@kernel.org>, Kees Cook <keescook@chromium.org>
Cc: "Darrick J. Wong" <djwong@kernel.org>,
	Daniel Latypov <dlatypov@google.com>, <storagedev@microchip.com>,
	<linux-nvme@lists.infradead.org>,
	James Smart <james.smart@broadcom.com>,
	"Guo Xuenan" <guoxuenan@huawei.com>,
	Eric Dumazet <edumazet@google.com>,
	"Tony Nguyen" <anthony.l.nguyen@intel.com>,
	<linux-hardening@vger.kernel.org>, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>, <linux-scsi@vger.kernel.org>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Christoph Hellwig <hch@infradead.org>,
	<intel-wired-lan@lists.osuosl.org>,
	Paolo Abeni <pabeni@redhat.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Gwan-gyeong Mun" <gwan-gyeong.mun@intel.com>,
	Dave Chinner <dchinner@redhat.com>,
	"Keith Busch" <kbusch@kernel.org>,
	HighPoint Linux Team <linux@highpoint-tech.com>,
	<megaraidlinux.pdl@broadcom.com>, Jens Axboe <axboe@kernel.dk>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>,
	<netdev@vger.kernel.org>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	<linux-kernel@vger.kernel.org>, <linux-xfs@vger.kernel.org>,
	Sumit Saxena <sumit.saxena@broadcom.com>,
	"Tales Aparecida" <tales.aparecida@gmail.com>,
	Don Brace <don.brace@microchip.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [Intel-wired-lan] [PATCH] overflow: Add struct_size_t() helper
Date: Wed, 24 May 2023 16:17:56 +0200	[thread overview]
Message-ID: <1d909989-5418-17ca-f161-67b4c05c6fb2@intel.com> (raw)
In-Reply-To: <20230523205354.06b147c6@kernel.org>

From: Jakub Kicinski <kuba@kernel.org>
Date: Tue, 23 May 2023 20:53:54 -0700

> On Mon, 22 May 2023 14:18:13 -0700 Kees Cook wrote:
>> diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.h b/drivers/net/ethernet/intel/ice/ice_ddp.h
>> index 37eadb3d27a8..41acfe26df1c 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_ddp.h
>> +++ b/drivers/net/ethernet/intel/ice/ice_ddp.h
>> @@ -185,7 +185,7 @@ struct ice_buf_hdr {
>>  
>>  #define ICE_MAX_ENTRIES_IN_BUF(hd_sz, ent_sz)                                 \
>>  	((ICE_PKG_BUF_SIZE -                                                  \
>> -	  struct_size((struct ice_buf_hdr *)0, section_entry, 1) - (hd_sz)) / \
>> +	  struct_size_t(struct ice_buf_hdr,  section_entry, 1) - (hd_sz)) / \
>>  	 (ent_sz))
>>  
>>  /* ice package section IDs */
>> @@ -297,7 +297,7 @@ struct ice_label_section {
>>  };
>>  
>>  #define ICE_MAX_LABELS_IN_BUF                                             \
>> -	ICE_MAX_ENTRIES_IN_BUF(struct_size((struct ice_label_section *)0, \
>> +	ICE_MAX_ENTRIES_IN_BUF(struct_size_t(struct ice_label_section,  \
>>  					   label, 1) -                    \
>>  				       sizeof(struct ice_label),          \
>>  			       sizeof(struct ice_label))
>> @@ -352,7 +352,7 @@ struct ice_boost_tcam_section {
>>  };
>>  
>>  #define ICE_MAX_BST_TCAMS_IN_BUF                                               \
>> -	ICE_MAX_ENTRIES_IN_BUF(struct_size((struct ice_boost_tcam_section *)0, \
>> +	ICE_MAX_ENTRIES_IN_BUF(struct_size_t(struct ice_boost_tcam_section,  \
>>  					   tcam, 1) -                          \
>>  				       sizeof(struct ice_boost_tcam_entry),    \
>>  			       sizeof(struct ice_boost_tcam_entry))
>> @@ -372,8 +372,7 @@ struct ice_marker_ptype_tcam_section {
>>  };
>>  
>>  #define ICE_MAX_MARKER_PTYPE_TCAMS_IN_BUF                                    \
>> -	ICE_MAX_ENTRIES_IN_BUF(                                              \
>> -		struct_size((struct ice_marker_ptype_tcam_section *)0, tcam, \
>> +	ICE_MAX_ENTRIES_IN_BUF(struct_size_t(struct ice_marker_ptype_tcam_section,  tcam, \
>>  			    1) -                                             \
>>  			sizeof(struct ice_marker_ptype_tcam_entry),          \
>>  		sizeof(struct ice_marker_ptype_tcam_entry))
> 
> Acked-by: Jakub Kicinski <kuba@kernel.org>
> 
> but Intel ICE folks please speak up if this has a high chance of
> conflicts, I think I've seen some ICE DDP patches flying around :(

I haven't found anything that would conflict with this, esp. since it
implies no functional changes.
I agree it's been much needed, great, thanks!

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>

Olek

  reply	other threads:[~2023-05-24 14:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 21:18 Kees Cook
2023-05-22 21:32 ` Darrick J. Wong
2023-05-22 21:34 ` [Intel-wired-lan] " Gustavo A. R. Silva
2023-05-22 22:42 ` Martin K. Petersen
2023-05-23  5:54 ` Christoph Hellwig
2023-05-24  3:53 ` Jakub Kicinski
2023-05-24 14:17   ` Alexander Lobakin [this message]
2023-05-24 15:46     ` [Intel-wired-lan] " Tony Nguyen

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=1d909989-5418-17ca-f161-67b4c05c6fb2@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=dchinner@redhat.com \
    --cc=djwong@kernel.org \
    --cc=dlatypov@google.com \
    --cc=don.brace@microchip.com \
    --cc=edumazet@google.com \
    --cc=guoxuenan@huawei.com \
    --cc=gwan-gyeong.mun@intel.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=james.smart@broadcom.com \
    --cc=jejb@linux.ibm.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=kbusch@kernel.org \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=linux@highpoint-tech.com \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sagi@grimberg.me \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=storagedev@microchip.com \
    --cc=sumit.saxena@broadcom.com \
    --cc=tales.aparecida@gmail.com \
    /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

all inboxes | Powered by JetHome®