Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932563AbcCKWKX (ORCPT ); Fri, 11 Mar 2016 17:10:23 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33496 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932084AbcCKWKU (ORCPT ); Fri, 11 Mar 2016 17:10:20 -0500 MIME-Version: 1.0 In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F3A005009@ORSMSX114.amr.corp.intel.com> References: <56E1CA7B.5040706@nextfour.com> <3908561D78D1C84285E8C5FCA982C28F3A005009@ORSMSX114.amr.corp.intel.com> Date: Fri, 11 Mar 2016 14:10:18 -0800 Message-ID: Subject: Re: [PATCH v14] x86, mce: Add memcpy_mcsafe() From: Tony Luck To: =?UTF-8?Q?Mika_Penttil=C3=A4?= , Ingo Molnar Cc: "linux-kernel@vger.kernel.org" , Linus Torvalds , Thomas Gleixner , Borislav Petkov , Andrew Morton , Tony Luck , Peter Zijlstra , "H. Peter Anvin" , Andy Lutomirski , "Williams, Dan J" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 728 Lines: 20 On Thu, Mar 10, 2016 at 11:37 AM, Luck, Tony wrote: >> But you return 0 == false for success and 1 == true for failure. > > Aaargh! -ETOOMUCHSHELLSCRIPTPROGRAMMING > > -Tony Options to fix this: 1) Just change the comments in the code. This seems like it would confuse people as I thing most people would expect the "true" return to mean the copy succeeded. 2) Reverse the return values. Better that option 1 - but doesn't leave scope to return a count if some future user does want to know where the copy failed. 3) Change the return type back from "bool" to "int" 0 == success, non-zero == fail (with option to put the non-copied byte count in later). 4) Something else -Tony