Re: [CHECKER] 54 missing null pointer checks in 2.4.17

From: Andreas Dilger (
Date: Mon Jun 10 2002 - 00:28:07 EST

On Jun 09, 2002 20:55 -0700, Dawson Engler wrote:
> 2 | /fs/dcache.c
> 1 | /fs/sysctl.c
> /u2/engler/mc/oses/linux/2.4.17/fs/intermezzo/dcache.c
> /u2/engler/mc/oses/linux/2.4.17/fs/intermezzo/sysctl.c

It looks like you are dropping part of the path out of the short list.
There is a file fs/dcache.c, but also fs/intermezzo/dcache.c where the
error is shown. I have passed these errors on to the InterMezzo mailing

> /u2/engler/mc/oses/linux/2.4.17/fs/jbd/journal.c
> * Do we need to do a data copy?
> */
> if (need_copy_out && !done_copy_out) {
> char *tmp;
> Start --->
> tmp = jbd_rep_kmalloc(jh2bh(jh_in)->b_size, GFP_NOFS);
> jh_in->b_frozen_data = tmp;
> Error --->
> memcpy (tmp, mapped_data, jh2bh(jh_in)->b_size);

Note that jbd_rep_kmalloc() is a special case, and will not currently
return NULL. This macro calls __jbd_rep_kmalloc(..., retry=1) which
means "repeat the allocation until it succeeds" so the code path
"if (!retry) return NULL" can never actually happen from this caller.
The logic is somewhat convoluted, so it is not surprising that the
checker didn't distinguish this case (it would have to have done the
"constant" evaluation to drop the NULL return path from the code).

Cheers, Andreas

Andreas Dilger

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to More majordomo info at Please read the FAQ at

This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:15 EST