Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751585AbaLNWen (ORCPT ); Sun, 14 Dec 2014 17:34:43 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:55277 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750727AbaLNWeg (ORCPT ); Sun, 14 Dec 2014 17:34:36 -0500 From: Rickard Strandqvist To: Oleg Drokin , Andreas Dilger Cc: Rickard Strandqvist , Greg Kroah-Hartman , Greg Donald , Brilliantov Kirill Vladimirovich , HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: lustre: lustre: osc: lproc_osc.c: Fix for possible null pointer dereference Date: Sun, 14 Dec 2014 23:37:18 +0100 Message-Id: <1418596638-24646-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is otherwise a risk of a possible null pointer dereference. Was largely found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist --- drivers/staging/lustre/lustre/osc/lproc_osc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index 9f719bc..9ba6293 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -237,13 +237,15 @@ static ssize_t osc_cur_grant_bytes_seq_write(struct file *file, const char *buff size_t count, loff_t *off) { struct obd_device *obd = ((struct seq_file *)file->private_data)->private; - struct client_obd *cli = &obd->u.cli; + struct client_obd *cli; int rc; __u64 val; if (obd == NULL) return 0; + cli = &obd->u.cli; + rc = lprocfs_write_u64_helper(buffer, count, &val); if (rc) return rc; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/