On Wed, 16 Jan 2008 07:33:29 +1100, Chandan Talukdar <chandan@xxxxxxxxx>
wrote:
Hi Barry,
- In process_misc_ino_types(), dino->di_core.di_size is being accessed
without being converted to machine format. The check is being performed
against 0; so, it should be fine. But for better code readability, I
guess it should be accessed through be64_to_cpu().
Yeah... sort of in two-minds about this one.
- In change_dinode_fmt(), it might be worthwhile to add an ASSERT
against someone passing a value greater than 16 bit for 'new_fmt'.
Good idea.
- In process_inode_attr_fork(), di_anextents should be accessed using
be16_to_cpu as it is a 16 bit quantity.
- In process_dinode_int() line 2691, dinoc->di_extsize should be
accessed using be32_to_cpu().
Good pickup on these, thanks :)
- In process_dinode_int(), we should be checking for 'dblkmap' not being
NULL before freeing it. There are a few error conditions which can
cause the control to go to 'clear_bad_out' with dblkmap being NULL.
freeing a NULL is valid, from the man page:
free() frees the memory space pointed to by ptr, which must have been
returned by a previous call to malloc(), calloc() or realloc(). Otherwise,
or if free(ptr) has already been called before, undefined behaviour occurs.
>>> If ptr is NULL, no operation is performed. <<<
Thanks,
Chandan
|