On Mon, 26 Sep, at 11:14:49AM, Ivan Hu wrote: > Cleanup the warning, > drivers/firmware/efi/test/efi_test.c:269:8-15: WARNING opportunity for > memdup_user > > Use memdup_user rather than duplicating its implementation > This is a little bit restricted to reduce false positives I don't understand this sentence. What restriction are you talking about? > Generated by: coccinelle/api/memdup_user.coc > > Signed-off-by: Ivan Hu <ivan.hu@xxxxxxxxxxxxx> > --- > drivers/firmware/efi/test/efi_test.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c > index f61bb52..5602c46 100644 > --- a/drivers/firmware/efi/test/efi_test.c > +++ b/drivers/firmware/efi/test/efi_test.c > @@ -266,14 +266,10 @@ static long efi_runtime_set_variable(unsigned long arg) > return rv; > } > > - data = kmalloc(setvariable.data_size, GFP_KERNEL); > - if (!data) { > + data = memdup_user(setvariable.data, setvariable.data_size); > + if (IS_ERR(data)) { > kfree(name); > - return -ENOMEM; > - } > - if (copy_from_user(data, setvariable.data, setvariable.data_size)) { > - rv = -EFAULT; > - goto out; > + return PTR_ERR(data); > } > > status = efi.set_variable(name, &vendor_guid, > -- > 1.9.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html