Re: [PATCH] mips: avoid explicit UB in assignment of mips_io_port_base

From: Paul Burton
Date: Sat Aug 24 2019 - 10:12:55 EST


Hi Nick,

On Fri, Aug 23, 2019 at 10:16:04AM -0700, Nick Desaulniers wrote:
> On Tue, Aug 20, 2019 at 10:15 AM Nick Desaulniers
> <ndesaulniers@xxxxxxxxxx> wrote:
> > Hi Paul,
> > Bumping this thread; we'd really like to be able to boot test another
> > ISA in our CI. This lone patch is affecting our ability to boot. Can
> > you please pick it up?
> > https://lore.kernel.org/lkml/20190729211014.39333-1-ndesaulniers@xxxxxxxxxx/
>
> Hi Paul,
> Following up with this link that explains the undefined behavior issue more:
> https://wiki.sei.cmu.edu/confluence/display/c/EXP05-C.+Do+not+cast+away+a+const+qualification
> Please reconsider accepting this patch.

Sorry, it's been a crazy few months & I'm currently away awaiting my
father's funeral so I'm working through a backlog & catching up on
things.

It will be a shame to lose the optimization opportunities const offers
us, but it is an ugly hack & so I'm OK with applying this. It's likely
to affect older machines more than newer ones (which tend to use less or
no I/O port access) so I'm not too worried about the impact, but if we
find it matters we can always try the fixmap approach I suggested
previously.

Thanks,
Paul