From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758434AbbA2U0Y (ORCPT ); Thu, 29 Jan 2015 15:26:24 -0500 Received: from mga03.intel.com ([134.134.136.65]:20223 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758356AbbA2U0V convert rfc822-to-8bit (ORCPT ); Thu, 29 Jan 2015 15:26:21 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,487,1418112000"; d="scan'208";a="519830088" From: "Drokin, Oleg" To: Frank Zago CC: Rickard Strandqvist , "Dilger, Andreas" , "HPDD-discuss@lists.01.org" , Greg Kroah-Hartman , "devel@driverdev.osuosl.org" , "Linux Kernel Mailing List" Subject: Re: [HPDD-discuss] [PATCH] staging: lustre: include: lustre_update.h: Fix for possible null pointer dereference Thread-Topic: [HPDD-discuss] [PATCH] staging: lustre: include: lustre_update.h: Fix for possible null pointer dereference Thread-Index: AQHQO/OYu3/i6+bREUmdDrlI5FWsA5zYBQ2AgAAB8oCAAACrAIAACjiA Date: Thu, 29 Jan 2015 20:26:18 +0000 Message-ID: <9BE9E2B0-1326-4E5E-BCD1-9E9AD12FA784@intel.com> References: <1422557229-3484-1-git-send-email-rickard_strandqvist@spectrumdigital.se> <54CA8CA7.2070403@cray.com> <54CA8ED8.5040202@cray.com> In-Reply-To: <54CA8ED8.5040202@cray.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.14.30] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! On Jan 29, 2015, at 2:49 PM, Frank Zago wrote: >>>> @@ -165,12 +165,14 @@ static inline int update_get_reply_buf(struct >>>> update_reply *reply, void **buf, >>>> int result; >>>> >>>> ptr = update_get_buf_internal(reply, index, &size); >>>> + >>>> + LASSERT((ptr != NULL && size >= sizeof(int))); >>> >>> >>> Now size is tested before result. So it could assert if result < 0, while >>> the function would have returned before. >> >> But if prt is null krachar on the line: >> result = *(int *)ptr; >> >> Maybe there should be two LASSERT then. > > > Yes, that would be safer. Actually I just noticed this function does not appear to be used in the client code at all. As such let's just remove update_get_reply_buf()? In fat I bet this entire lustre_update.h contains server side updating code, and is unused anywhere in the client code, so we might just be able to easily remove that. I see the only includer is ./lustre/ptlrpc/layout.c that I don't think actually uses anything there? Thanks. Bye, Oleg