linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] net: wireless: use struct_size where appropriate
@ 2023-02-27 20:39 Jacob Keller
  2023-02-28  6:24 ` Kalle Valo
  0 siblings, 1 reply; 5+ messages in thread
From: Jacob Keller @ 2023-02-27 20:39 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Jacob Keller, linux-wireless

This series fixes a few wireless drivers to use struct_size rather than open
coding some equivalent checks. This ensures that these size calculations
will not overflow but instead be bounded at SIZE_MAX.

In the first case, the code is first converted to a flexible array, which
saves a few bytes of memory in addition to the fix with struct_size.

These were caught with a coccinelle patch I recently posted at [1].

[1]: https://lore.kernel.org/all/20230227202428.3657443-1-jacob.e.keller@intel.com/

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org

Jacob Keller (3):
  wifi: ipw2x00: convert ipw_fw_error->elem to flexible array[]
  wifi: cfg80211: use struct_size and size_sub for payload length
  wifi: nl80211: convert cfg80211_scan_request allocation to *_size
    macros

 drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  7 +++--
 drivers/net/wireless/intel/ipw2x00/ipw2200.h  |  3 +--
 .../net/wireless/quantenna/qtnfmac/commands.c |  7 ++---
 net/wireless/nl80211.c                        | 26 ++++++++++---------
 4 files changed, 22 insertions(+), 21 deletions(-)

-- 
2.39.1.405.gd4c25cc71f83


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

* Re: [PATCH 0/3] net: wireless: use struct_size where appropriate
  2023-02-27 20:39 [PATCH 0/3] net: wireless: use struct_size where appropriate Jacob Keller
@ 2023-02-28  6:24 ` Kalle Valo
  2023-02-28 16:21   ` Keller, Jacob E
  0 siblings, 1 reply; 5+ messages in thread
From: Kalle Valo @ 2023-02-28  6:24 UTC (permalink / raw)
  To: Jacob Keller; +Cc: Johannes Berg, linux-wireless

Jacob Keller <jacob.e.keller@intel.com> writes:

> This series fixes a few wireless drivers to use struct_size rather than open
> coding some equivalent checks. This ensures that these size calculations
> will not overflow but instead be bounded at SIZE_MAX.
>
> In the first case, the code is first converted to a flexible array, which
> saves a few bytes of memory in addition to the fix with struct_size.
>
> These were caught with a coccinelle patch I recently posted at [1].
>
> [1]: https://lore.kernel.org/all/20230227202428.3657443-1-jacob.e.keller@intel.com/
>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Cc: linux-wireless@vger.kernel.org
>
> Jacob Keller (3):
>   wifi: ipw2x00: convert ipw_fw_error->elem to flexible array[]
>   wifi: cfg80211: use struct_size and size_sub for payload length
>   wifi: nl80211: convert cfg80211_scan_request allocation to *_size
>     macros
>
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  7 +++--
>  drivers/net/wireless/intel/ipw2x00/ipw2200.h  |  3 +--
>  .../net/wireless/quantenna/qtnfmac/commands.c |  7 ++---
>  net/wireless/nl80211.c                        | 26 ++++++++++---------
>  4 files changed, 22 insertions(+), 21 deletions(-)

I don't see the actual patches, only the cover letter. Also nothing on
patchwork:

https://patchwork.kernel.org/project/linux-wireless/list/?state=*

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* RE: [PATCH 0/3] net: wireless: use struct_size where appropriate
  2023-02-28  6:24 ` Kalle Valo
@ 2023-02-28 16:21   ` Keller, Jacob E
  0 siblings, 0 replies; 5+ messages in thread
From: Keller, Jacob E @ 2023-02-28 16:21 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Johannes Berg, linux-wireless@vger.kernel.org



> -----Original Message-----
> From: Kalle Valo <kvalo@kernel.org>
> Sent: Monday, February 27, 2023 10:24 PM
> To: Keller, Jacob E <jacob.e.keller@intel.com>
> Cc: Johannes Berg <johannes@sipsolutions.net>; linux-wireless@vger.kernel.org
> Subject: Re: [PATCH 0/3] net: wireless: use struct_size where appropriate
> 
> Jacob Keller <jacob.e.keller@intel.com> writes:
> 
> > This series fixes a few wireless drivers to use struct_size rather than open
> > coding some equivalent checks. This ensures that these size calculations
> > will not overflow but instead be bounded at SIZE_MAX.
> >
> > In the first case, the code is first converted to a flexible array, which
> > saves a few bytes of memory in addition to the fix with struct_size.
> >
> > These were caught with a coccinelle patch I recently posted at [1].
> >
> > [1]: https://lore.kernel.org/all/20230227202428.3657443-1-
> jacob.e.keller@intel.com/
> >
> > Cc: Johannes Berg <johannes@sipsolutions.net>
> > Cc: linux-wireless@vger.kernel.org
> >
> > Jacob Keller (3):
> >   wifi: ipw2x00: convert ipw_fw_error->elem to flexible array[]
> >   wifi: cfg80211: use struct_size and size_sub for payload length
> >   wifi: nl80211: convert cfg80211_scan_request allocation to *_size
> >     macros
> >
> >  drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  7 +++--
> >  drivers/net/wireless/intel/ipw2x00/ipw2200.h  |  3 +--
> >  .../net/wireless/quantenna/qtnfmac/commands.c |  7 ++---
> >  net/wireless/nl80211.c                        | 26 ++++++++++---------
> >  4 files changed, 22 insertions(+), 21 deletions(-)
> 
> I don't see the actual patches, only the cover letter. Also nothing on
> patchwork:
> 
> https://patchwork.kernel.org/project/linux-wireless/list/?state=*
> 

Hmm.. Let me resend.

Thanks,
Jake

> --
> https://patchwork.kernel.org/project/linux-wireless/list/
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatch
> es

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

* [PATCH 0/3] net: wireless: use struct_size where appropriate
@ 2023-02-28 16:22 Jacob Keller
  2023-02-28 16:29 ` Jacob Keller
  0 siblings, 1 reply; 5+ messages in thread
From: Jacob Keller @ 2023-02-28 16:22 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Kalle Valo, Jacob Keller, linux-wireless

This series fixes a few wireless drivers to use struct_size rather than open
coding some equivalent checks. This ensures that these size calculations
will not overflow but instead be bounded at SIZE_MAX.

In the first case, the code is first converted to a flexible array, which
saves a few bytes of memory in addition to the fix with struct_size.

These were caught with a coccinelle patch I recently posted at [1].

[1]: https://lore.kernel.org/all/20230227202428.3657443-1-jacob.e.keller@intel.com/

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org

Jacob Keller (3):
  wifi: ipw2x00: convert ipw_fw_error->elem to flexible array[]
  wifi: cfg80211: use struct_size and size_sub for payload length
  wifi: nl80211: convert cfg80211_scan_request allocation to *_size
    macros

 drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  7 +++--
 drivers/net/wireless/intel/ipw2x00/ipw2200.h  |  3 +--
 .../net/wireless/quantenna/qtnfmac/commands.c |  7 ++---
 net/wireless/nl80211.c                        | 26 ++++++++++---------
 4 files changed, 22 insertions(+), 21 deletions(-)

-- 
2.39.1.405.gd4c25cc71f83


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

* Re: [PATCH 0/3] net: wireless: use struct_size where appropriate
  2023-02-28 16:22 Jacob Keller
@ 2023-02-28 16:29 ` Jacob Keller
  0 siblings, 0 replies; 5+ messages in thread
From: Jacob Keller @ 2023-02-28 16:29 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Kalle Valo, linux-wireless



On 2/28/2023 8:22 AM, Jacob Keller wrote:
> This series fixes a few wireless drivers to use struct_size rather than open
> coding some equivalent checks. This ensures that these size calculations
> will not overflow but instead be bounded at SIZE_MAX.
> 
> In the first case, the code is first converted to a flexible array, which
> saves a few bytes of memory in addition to the fix with struct_size.
> 
> These were caught with a coccinelle patch I recently posted at [1].
> 
> [1]: https://lore.kernel.org/all/20230227202428.3657443-1-jacob.e.keller@intel.com/
> 
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Cc: linux-wireless@vger.kernel.org
> 
> Jacob Keller (3):
>   wifi: ipw2x00: convert ipw_fw_error->elem to flexible array[]
>   wifi: cfg80211: use struct_size and size_sub for payload length
>   wifi: nl80211: convert cfg80211_scan_request allocation to *_size
>     macros
> 
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  7 +++--
>  drivers/net/wireless/intel/ipw2x00/ipw2200.h  |  3 +--
>  .../net/wireless/quantenna/qtnfmac/commands.c |  7 ++---
>  net/wireless/nl80211.c                        | 26 ++++++++++---------
>  4 files changed, 22 insertions(+), 21 deletions(-)
> 

ugh sorry for the spam.. the actual patches didn't get cc'd to
linux-wireless. I've fixed that now.

Thanks,
Jake

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

end of thread, other threads:[~2023-02-28 16:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27 20:39 [PATCH 0/3] net: wireless: use struct_size where appropriate Jacob Keller
2023-02-28  6:24 ` Kalle Valo
2023-02-28 16:21   ` Keller, Jacob E
  -- strict thread matches above, loose matches on Subject: below --
2023-02-28 16:22 Jacob Keller
2023-02-28 16:29 ` Jacob Keller

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).