From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 58E668069 for ; Tue, 9 Dec 2014 10:52:32 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 09 Dec 2014 01:52:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="495932251" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga003.jf.intel.com with ESMTP; 09 Dec 2014 01:48:45 -0800 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.244]) by IRSMSX103.ger.corp.intel.com ([169.254.3.134]) with mapi id 14.03.0195.001; Tue, 9 Dec 2014 09:51:02 +0000 From: "Burakov, Anatoly" To: "Qiu, Michael" , Michael Qiu , "dev@dpdk.org" Thread-Topic: [PATCH v2] VFIO: Avoid to enable vfio while the module not loaded Thread-Index: AQHQEFe5ciA3i4rZ4ka+imWWJV+oY5yHCjBw Date: Tue, 9 Dec 2014 09:51:00 +0000 Message-ID: References: <1417664219-19679-1-git-send-email-michael.qiu@intel.com> <1417687227-21854-1-git-send-email-michael.qiu@intel.com> <533710CFB86FA344BFBF2D6802E60286C9D920@SHSMSX101.ccr.corp.intel.com> <533710CFB86FA344BFBF2D6802E60286C9DE19@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <533710CFB86FA344BFBF2D6802E60286C9DE19@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] VFIO: Avoid to enable vfio while the module not loaded X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2014 09:52:32 -0000 Hi Michael, >=20 > Yes, you are right, strncmp() will check 30 bytes if use sizeof(buffer). >=20 > But any issue of strcmp() ? This rountin cares about exactly match. I thi= nk no > need to convert to strncmp() if it does have other issue. >=20 > > fscanf with fgets would be better too, to make sure we never go over ou= r > buffer size when dealing with /proc/modules. >=20 > If we use fgets, we need additional efforts to get the modname, for > potential overflow issue, we can limit counts of fscanf(). like below: >=20 > fscanf(fd, "%30s %*[^\n]", mod_name); >=20 As long as it doesn't cause easy buffer overruns, I'm fine with it :-) Thanks, Anatoly