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

From: Nick Desaulniers
Date: Mon Aug 26 2019 - 13:31:24 EST


On Sat, Aug 24, 2019 at 7:12 AM Paul Burton <paul.burton@xxxxxxxx> wrote:
>
> 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.

That's an extremely tough hand to be dealt. Got it myself a week
before I turned 20. Technically, (spoiler) everyone is eventually
dealt it; not that that or really anything else can ever truly provide
solace despite the common refrain "time heals all wounds" (Narrator:
it doesn't). Depending on where you are in life it can really really
destabilize things. I wrote this blog post
(https://nickdesaulniers.github.io/blog/2013/04/29/the-persistence-of-memory/)
that I'm not too proud of at a time I now realize that I was still
kind of a state of shock (even years later). I also found it very
difficult to accept advice from others who didn't share the experience
of losing a parent.

No one would fault you for asking your co-maintainers to handle more
maintainer responsibilities for a while. I hope you can find a friend
to commiserate with over beers. I owe you one.

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



--
Thanks,
~Nick Desaulniers