Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755548AbbBBXQx (ORCPT ); Mon, 2 Feb 2015 18:16:53 -0500 Received: from linuxhacker.ru ([217.76.32.60]:49189 "EHLO fiona.linuxhacker.ru" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751854AbbBBXQv convert rfc822-to-8bit (ORCPT ); Mon, 2 Feb 2015 18:16:51 -0500 Subject: Re: [PATCH 06/20] staging/lustre: fix comparison between signed and unsigned Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=windows-1252 From: Oleg Drokin In-Reply-To: <20150202205143.GA6369@kroah.com> Date: Mon, 2 Feb 2015 18:16:36 -0500 Cc: Dan Carpenter , devel@driverdev.osuosl.org, Dmitry Eremin , Andreas Dilger , Linux Kernel Mailing List Content-Transfer-Encoding: 8BIT Message-Id: References: <1422845539-26742-1-git-send-email-green@linuxhacker.ru> <1422845539-26742-7-git-send-email-green@linuxhacker.ru> <20150202130231.GA5451@mwanda> <20150202154400.GB18209@kroah.com> <210DE60C-B152-4DF5-B6FC-06CD47CD36B9@linuxhacker.ru> <20150202205143.GA6369@kroah.com> To: Greg Kroah-Hartman X-Mailer: Apple Mail (2.1283) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1151 Lines: 34 On Feb 2, 2015, at 3:51 PM, Greg Kroah-Hartman wrote: > On Mon, Feb 02, 2015 at 03:25:58PM -0500, Oleg Drokin wrote: >>> What is this code supposed to be protecting from? And -1? That should >>> never be a return value? >> >> Why is -1 a bad return value if all callsites check for that as an >> indication of error? > > Because you should use "real" error values, don't make them up with > random negative numbers that mean nothing. > >> (granted there's only one caller at this point in kernel space: >> lustre/llite/dir.c::ll_dir_ioctl() >> totalsize = hur_len(hur); >> OBD_FREE_PTR(hur); >> if (totalsize < 0) >> return -E2BIG; >> ) > > Shouldn't you have returned the error that hur_len() passed you? Ok, I guess that makes quite a bit of sense too. I'll do an updated patch about that later on then. Thanks! Bye, Oleg-- 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/