Subject: Re: linux-next: manual merge of the char-misc tree with the char-misc.current tree

From: Kees Cook <[email-masked]>
Date: Fri, 7 Jan 2022 15:18:54 -0800

On Mon, Dec 13, 2021 at 10:18:07AM +0100, Greg KH wrote:
> On Mon, Dec 06, 2021 at 06:44:04PM +0200, Andy Shevchenko wrote:
> > On Mon, Dec 06, 2021 at 11:17:34AM -0500, Ralph Siemsen wrote:
> > > On Mon, Dec 06, 2021 at 03:43:11PM +0200, Andy Shevchenko wrote:
> > > > On Mon, Dec 06, 2021 at 02:49:01PM +1100, Stephen Rothwell wrote:
> > > > > Hi all,
> > > > > 
> > > > > Today's linux-next merge of the char-misc tree got a conflict in:
> > > > > 
> > > > >   drivers/misc/eeprom/at25.c
> > > > > 
> > > > > between commit:
> > > > > 
> > > > >   9a626577398c ("nvmem: eeprom: at25: fix FRAM byte_len")
> > > 
> > > This was my original patch from Nov 8th.
> > > 
> > > > >   5b557298d7d0 ("misc: at25: Make driver OF independent again")
> > > > >   a692fc39bf90 ("misc: at25: Don't copy garbage to the at25->chip in FRAM case")
> > > > >   58589a75bba9 ("misc: at25: Check proper value of chip length in FRAM case")
> > > > >   51902c1212fe ("misc: at25: Use at25->chip instead of local chip everywhere in ->probe()")
> > > > > (and probably more)
> > > 
> > > These are newer versions and some cleanups from Andy. I was not aware of
> > > this work going on. I'm surprised at25 is getting so much attention ;-)
> > 
> > Me neither. :-)
> > 
> > > > > I fixed it up (I just used the latter version) and can carry the fix as
> > > > > necessary. This is now fixed as far as linux-next is concerned, but any
> > > > > non trivial conflicts should be mentioned to your upstream maintainer
> > > > > when your tree is submitted for merging.  You may also want to consider
> > > > > cooperating with the maintainer of the conflicting tree to minimise any
> > > > > particularly complex conflicts.
> > > > 
> > > > The result from char-misc.current should be used as is and I guess it's
> > > > what you have done, thanks!
> > > 
> > > Agreed - Andy's version is cleaner, and includes my fixes. I've run some
> > > quick tests locally and all seems to be working as expected.
> > 
> > Thanks, Ralph!
> 
> This should now be resolved in my tree, thanks.

I think something has gone very wrong here. The allocation for "at25" is
now missing in at25_probe():

-       at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL);
-       if (!at25)
-               return -ENOMEM;
-

This leads to a fair bit of confusion from static analysis which sees
the "at25" as basically empty. :P

-- 
Kees Cook