From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752277Ab1GSMIU (ORCPT ); Tue, 19 Jul 2011 08:08:20 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:52968 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751032Ab1GSMIS (ORCPT ); Tue, 19 Jul 2011 08:08:18 -0400 Subject: Re: [PATCH] Add error check to hex2bin(). From: Mimi Zohar To: Andy Shevchenko Cc: Geert Uytterhoeven , Tetsuo Handa , linux-security-module@vger.kernel.org, andriy.shevchenko@linux.intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: <1310977597-9666-1-git-send-email-andriy.shevchenko@linux.intel.com> <201107182041.EHB78622.VOFSHFMOOFtLJQ@I-love.SAKURA.ne.jp> <1310991796.3903.6.camel@smile> <201107182148.AGD21306.FOLtJVMSOOFQHF@I-love.SAKURA.ne.jp> Content-Type: text/plain; charset="UTF-8" Date: Mon, 18 Jul 2011 17:59:25 -0400 Message-ID: <1311026365.3648.110.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 (2.30.3-1.fc13) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2011-07-19 at 00:18 +0300, Andy Shevchenko wrote: > On Mon, Jul 18, 2011 at 11:49 PM, Geert Uytterhoeven > wrote: > > What about making it return the number of unprocessed bytes left instead? > > Then the caller knows where the problem lies. And zero would mean success. > If I remember correctly it used to be src as return value in some > version of that patch. I don't know the details of that interim > solution. My current opinion is to return boolean and make an > additional parameter to return src value. However, it could make this > simple function fat. > P.S. Take into account that the user of it is only one so far, I would > like to hear a Mimi's opinion. Trusted/encrypted keys are not in a critical code path. They're used for loading/storing key blobs from userspace. Once you change the API, short circuiting out and adding an error return, from a trusted/encrypted key perspective, it doesn't make a difference. thanks, Mimi