Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fcd869f authored by Sebastien Buisson's avatar Sebastien Buisson Committed by Greg Kroah-Hartman
Browse files

staging: lustre: fix 'NULL pointer dereference' errors



Fix 'NULL pointer dereference' defects found by Coverity version
6.5.0:
Dereference after null check (FORWARD_NULL)
For instance, Passing null pointer to a function which dereferences
it.
Dereference before null check (REVERSE_INULL)
Null-checking variable suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
Dereference null return value (NULL_RETURNS)

Signed-off-by: default avatarSebastien Buisson <sbuisson@ddn.com>
Signed-off-by: default avatarJames Nunez <james.a.nunez@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3042
Reviewed-on: http://review.whamcloud.com/5868


Reviewed-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a7a9ed4b
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -611,15 +611,16 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx)
	struct inode		*inode	= file_inode(filp);
	struct ll_file_data	*lfd	= LUSTRE_FPRIVATE(filp);
	struct ll_sb_info	*sbi	= ll_i2sbi(inode);
	__u64 pos = lfd ? lfd->lfd_pos : 0;
	int			hash64	= sbi->ll_flags & LL_SBI_64BIT_HASH;
	int			api32	= ll_need_32bit_api(sbi);
	int			rc;

	CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %lu/%llu 32bit_api %d\n",
	       inode->i_ino, inode->i_generation,
	       inode, (unsigned long)lfd->lfd_pos, i_size_read(inode), api32);
	       inode, (unsigned long)pos, i_size_read(inode), api32);

	if (lfd->lfd_pos == MDS_DIR_END_OFF) {
	if (pos == MDS_DIR_END_OFF) {
		/*
		 * end-of-file.
		 */
@@ -627,8 +628,9 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx)
		goto out;
	}

	ctx->pos = lfd->lfd_pos;
	ctx->pos = pos;
	rc = ll_dir_read(inode, ctx);
	if (lfd)
		lfd->lfd_pos = ctx->pos;
	if (ctx->pos == MDS_DIR_END_OFF) {
		if (api32)
+2 −1
Original line number Diff line number Diff line
@@ -277,10 +277,11 @@ struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio,
static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,
			     struct cl_io *io)
{
	struct lov_stripe_md *lsm = lio->lis_object->lo_lsm;
	struct lov_stripe_md *lsm;
	int result;

	LASSERT(lio->lis_object);
	lsm = lio->lis_object->lo_lsm;

	/*
	 * Need to be optimized, we can't afford to allocate a piece of memory