Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1265065
| From | Andy Shevchenko <andy.shevchenko@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 01/13] staging: rtl8188eu: if/else replaced by min_t |
| Date | 2015-11-08 11:10 +0100 |
| Message-ID | <qsv58-7cA-1@gated-at.bofh.it> (permalink) |
| References | <qss7g-57a-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sun, Nov 8, 2015 at 6:29 AM, Ivan Safonov <insafonov@gmail.com> wrote: > Duplicated code removed. > > Signed-off-by: Ivan Safonov <insafonov@gmail.com> > --- > drivers/staging/rtl8188eu/core/rtw_cmd.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c > index 433b926..69f8744d9 100644 > --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c > +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c > @@ -442,10 +442,8 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) > > psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->IELength; > > - if ((psecnetwork->IELength-12) < (256-1)) > - memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12); > - else > - memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1)); > + memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], > + min_t(size_t, psecnetwork->IELength - 12, 256 - 1)); 256 is a magic number. Like I said earlier, it seems a sizeof of corresponding member. > > psecnetwork->IELength = 0; > /* Added by Albert 2009/02/18 */ > -- > 2.4.10 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 01/13] staging: rtl8188eu: if/else replaced by min_t Ivan Safonov <insafonov@gmail.com> - 2015-11-08 08:00 +0100 Re: [PATCH 01/13] staging: rtl8188eu: if/else replaced by min_t Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-08 11:10 +0100
csiph-web