From patchwork Fri Jan 4 08:22:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Wang X-Patchwork-Id: 1931291 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 597723FF0F for ; Fri, 4 Jan 2013 08:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752910Ab3ADIXL (ORCPT ); Fri, 4 Jan 2013 03:23:11 -0500 Received: from mail-vc0-f181.google.com ([209.85.220.181]:32798 "EHLO mail-vc0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751448Ab3ADIXJ (ORCPT ); Fri, 4 Jan 2013 03:23:09 -0500 Received: by mail-vc0-f181.google.com with SMTP id gb30so16128429vcb.40 for ; Fri, 04 Jan 2013 00:23:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=Wx4gkkqYlTGlNc1OI4BUA7kMELnYtngsap0bZ2XyD5w=; b=iufdm4oy8Q/P1w6bpMaiErBS/uiV3RmiyZz5jV84cqcDyh4IcC+3TE8YmyHPXLUMFG RiaggDRiRHhLMqgpF3d1KpgozFAYqK72JfbGKclVVYmMQqC46LxsYx1XmiVn0S0J6m2Q jXL4JRuXZRw9ViPCKa97Gd9AbnJ1oa82ALiLb21/tPgWgGa6lRL/5MeosNd4HWv0NJ/W dW/VmvtBLY8cD6niW+r5HCVS51D/HkR1z2uPyaW7B8ZsxpWEAx4jMOiUb9IdXo8xq8ZY zD7ZIc9l0ntOIPbTP/Qw30AIZzSYmd7Zf01DqIyI42DPS2WTDIMgJOp3BJCFNXazDy2l izVg== X-Received: by 10.58.198.164 with SMTP id jd4mr78650497vec.34.1357287788750; Fri, 04 Jan 2013 00:23:08 -0800 (PST) Received: from hchen.lcs.mit.edu (26-4-178.dynamic.csail.mit.edu. [18.26.4.178]) by mx.google.com with ESMTPS id q13sm46419572vdh.22.2013.01.04.00.23.07 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Jan 2013 00:23:08 -0800 (PST) From: Xi Wang To: Trond Myklebust Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Xi Wang , stable@vger.kernel.org Subject: [PATCH] nfs: fix null checking in nfs_get_option_str() Date: Fri, 4 Jan 2013 03:22:57 -0500 Message-Id: <1357287777-12052-1-git-send-email-xi.wang@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The following null pointer check is broken. *option = match_strdup(args); return !option; The pointer `option' must be non-null, and thus `!option' is always false. Use `!*option' instead. The bug was introduced in commit c5cb09b6f8 ("Cleanup: Factor out some cut-and-paste code."). Signed-off-by: Xi Wang Cc: stable@vger.kernel.org --- fs/nfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index c25cadf8..2e7e8c8 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1152,7 +1152,7 @@ static int nfs_get_option_str(substring_t args[], char **option) { kfree(*option); *option = match_strdup(args); - return !option; + return !*option; } static int nfs_get_option_ul(substring_t args[], unsigned long *option)