From: Wolfgang Denk Date: Wed, 22 Nov 2017 09:09:36 +0100 Subject: [U-Boot] [PATCH 1/1] ubifs: avoid possible NULL dereference In-Reply-To: <20171121212222.ryicwv6tyh5rye2e@lenoch> References: <20171121184503.3193-1-xypron.glpk@gmx.de> <20171121211640.CE469120302@gemini.denx.de> <20171121212222.ryicwv6tyh5rye2e@lenoch> Message-ID: <20171122080936.32ECB12051D@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Ladislav, In message <20171121212222.ryicwv6tyh5rye2e@lenoch> you wrote: > > > > > > diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c > > > index 4465523d5f..313dee0579 100644 > > > --- a/fs/ubifs/ubifs.c > > > +++ b/fs/ubifs/ubifs.c > > > @@ -403,8 +403,7 @@ static int ubifs_finddir(struct super_block *sb, char *dirname, > > > dir = kzalloc(sizeof(struct inode), 0); > > > if (!file || !dentry || !dir) { > > > printf("%s: Error, no memory for malloc!\n", __func__); > > > - err = -ENOMEM; > > > - goto out; > > > + goto out_nomem; > > > } ... > > Should you not keep the "err = -ENOMEM;" setting? Otherwise there > > is no indivcation that an error happened. > > It is not obvious from the patch, but value of err is later discarded. > It serves sole purpose of printing debug notice. So apparently we have a number of places in U-Boot where fatal errors (running out of memory) are just ignored and we continue as if nothing happened? THis is short-sighted at best. One day Pump Six will fail. This is giving me the creepes. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Why don't you have a Linux partition installed so you can be working in a programmer-friendly environment instead of a keep-gates'-bank- account-happy one? :-) -- Tom Christiansen