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

Commit 9d79f1b4 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Linus Torvalds
Browse files

[PATCH] IB/mthca: Fix FMR breakage caused by kmemdup() conversion



Commit bed8bdfd ("IB: kmemdup() cleanup") introduced one bad conversion to
kmemdup() in mthca_alloc_fmr(), where the structure allocated and the
structure copied are not the same size.  Revert this back to the original
kmalloc()/memcpy() code.

Reported-by: default avatarDotan Barak <dotanb@mellanox.co.il&gt;.>
Signed-off-by: default avatarMichael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <roland@digitalvampire.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 31f87cf4
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1100,10 +1100,11 @@ static struct ib_fmr *mthca_alloc_fmr(struct ib_pd *pd, int mr_access_flags,
	struct mthca_fmr *fmr;
	struct mthca_fmr *fmr;
	int err;
	int err;


	fmr = kmemdup(fmr_attr, sizeof *fmr, GFP_KERNEL);
	fmr = kmalloc(sizeof *fmr, GFP_KERNEL);
	if (!fmr)
	if (!fmr)
		return ERR_PTR(-ENOMEM);
		return ERR_PTR(-ENOMEM);


	memcpy(&fmr->attr, fmr_attr, sizeof *fmr_attr);
	err = mthca_fmr_alloc(to_mdev(pd->device), to_mpd(pd)->pd_num,
	err = mthca_fmr_alloc(to_mdev(pd->device), to_mpd(pd)->pd_num,
			     convert_access(mr_access_flags), fmr);
			     convert_access(mr_access_flags), fmr);