From patchwork Sat May 6 15:34:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 9714933 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE30C60362 for ; Sat, 6 May 2017 15:34:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A98CA26C9B for ; Sat, 6 May 2017 15:34:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B6A528630; Sat, 6 May 2017 15:34:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3153E26C9B for ; Sat, 6 May 2017 15:34:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751400AbdEFPee (ORCPT ); Sat, 6 May 2017 11:34:34 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35239 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751376AbdEFPed (ORCPT ); Sat, 6 May 2017 11:34:33 -0400 Received: by mail-pg0-f67.google.com with SMTP id i63so4564783pgd.2; Sat, 06 May 2017 08:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=iO6ZFMSZVZdYIqBhW/jAexw4DNxPWE1rdeDcAfBVikM=; b=E7d4ztytZ+ypzpstdJslupybnGTxx0Cj4IVmYsDUvuTVgWJ7kt73DlLU4N/t4PfTtR k3iK3/TwipHVE+E5Yia7ooKhR45Ui3uFCYKcg4QjYIgAyvYOmu+59BZG9cjFDFAmpZJI kC/R7K+daxGTbGRsmtARwpYndzchfLfdclE9X+afBIR6+PwBw5iVwvpFRrGCxfGN3PNG 8f0wOsH+mVTlOAo8RcX5QrBlyltPiKdDO26e2NFvib8pwVrtYxedezXznCXbTETdCfBo 2dOoDeqWXHNyFb+tS+bc8WdybbAYsjN0pSbSPXusQK/4p6p4H6V4Lw5Ilb7ys4VtAbgi aanQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iO6ZFMSZVZdYIqBhW/jAexw4DNxPWE1rdeDcAfBVikM=; b=UC6fMQuaK6qChKUtN1Gs/CgHheT2gr81KhF3mqNM6rj1PkRzbmzRkoGLsHrzj3l/+K 6LFv4JTTZ38WNDr2lBf/EECIGZSSNKz9wH3M5UYWVgBAdvVJ4M9UwCNhw2ASRLjpQP8c qLnD93men7PrlhryHpH/nhBa5W/C+4C5nM1whIbjAmwXaL2qqHgEO10rc44Tz4ArNMyR GUOcf5gS6HdkXc4GIKJGwz7KIdmNf4XpdgZkqUqT62a8PuSePS6G6u20KVqAJErjaNs3 HUU7dgfBkE/Mcp6yu6qSsJ3rNE0UrH7UNUszLLNLCfJ4UcDYMJRRsBrY1vYP7Ziz/1aN o2dQ== X-Gm-Message-State: AN3rC/4KMhh5cn1KhCueFXY8rya5jjBxafJfrVvzGAOIpeejWzqPkw70 FYE+Jew6sV58vg== X-Received: by 10.84.175.132 with SMTP id t4mr34033493plb.180.1494084872936; Sat, 06 May 2017 08:34:32 -0700 (PDT) Received: from localhost (li409-196.members.linode.com. [106.187.89.196]) by smtp.gmail.com with ESMTPSA id 194sm9925983pgf.62.2017.05.06.08.34.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 May 2017 08:34:32 -0700 (PDT) From: Geliang Tang To: Matias Bjorling Cc: Geliang Tang , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] lightnvm: fix error return code of memdup_user Date: Sat, 6 May 2017 23:34:24 +0800 Message-Id: X-Mailer: git-send-email 2.11.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The error return code of memdup_user() should be -ENOMEM or -EFAULT. So this patch changed it to PTR_ERR(info). Signed-off-by: Geliang Tang Reviewed-by: Matias Bjørling --- drivers/lightnvm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 54a06c3..e8b5edd 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -1164,7 +1164,7 @@ static long nvm_ioctl_info(struct file *file, void __user *arg) info = memdup_user(arg, sizeof(struct nvm_ioctl_info)); if (IS_ERR(info)) - return -EFAULT; + return PTR_ERR(info); info->version[0] = NVM_VERSION_MAJOR; info->version[1] = NVM_VERSION_MINOR;