Re: [PATCH 6/6][next] airo: Avoid clashing function prototypes

From: Gustavo A. R. Silva
Date: Wed Oct 19 2022 - 01:59:19 EST




On 10/17/22 21:53, Kees Cook wrote:
On Mon, Oct 17, 2022 at 03:36:20PM -0500, Gustavo A. R. Silva wrote:
[...]
@@ -6312,16 +6326,16 @@ static int airo_get_mode(struct net_device *dev,
/* If not managed, assume it's ad-hoc */
switch (local->config.opmode & MODE_CFG_MASK) {
case MODE_STA_ESS:
- *uwrq = IW_MODE_INFRA;
+ uwrq->mode = IW_MODE_INFRA;
break;
case MODE_AP:
- *uwrq = IW_MODE_MASTER;
+ uwrq->mode = IW_MODE_MASTER;
break;
case MODE_AP_RPTR:
- *uwrq = IW_MODE_REPEAT;
+ uwrq->mode = IW_MODE_REPEAT;
break;
default:
- *uwrq = IW_MODE_ADHOC;
+ uwrq->mode = IW_MODE_ADHOC;
}
return 0;

Sometimes you use the union directly, sometimes not. What was your
heuristic for that?

Oh it is just that I had previously used a new variable in function airo_set_mode(),
and then I immediately ran into this similar scenario (function airo_get_mode) and
I said "wait a second, why don't I directly use the union, instead? :thinking_face:"
and I did, and moved on. :P


Regardless, looks good!

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>


Thanks for this!

BTW, I already have a new series (this time a 4-patch series, instead of 6), with
the latest fixes, here:

https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/log/?h=6.1-rc1-Wcast-function-type-strict

I think we could quickly review it tomorrow before I send it out. :)

--
Gustavo