From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3syxwR4N1YzDskb for ; Wed, 19 Oct 2016 01:17:11 +1100 (AEDT) Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3syxwQ4Z8bz9sC7 for ; Wed, 19 Oct 2016 01:17:09 +1100 (AEDT) Received: by mail-pf0-x241.google.com with SMTP id i85so11861362pfa.0 for ; Tue, 18 Oct 2016 07:17:09 -0700 (PDT) Subject: Re: [RFC PATCH 2/3] powerpc/pseries: Define & use a type for the plpar_hcall() retvals To: Michael Ellerman , linuxppc-dev@ozlabs.org References: <1476780032-21643-1-git-send-email-mpe@ellerman.id.au> <1476780032-21643-2-git-send-email-mpe@ellerman.id.au> From: Balbir Singh Message-ID: Date: Wed, 19 Oct 2016 01:17:11 +1100 MIME-Version: 1.0 In-Reply-To: <1476780032-21643-2-git-send-email-mpe@ellerman.id.au> Content-Type: text/plain; charset=windows-1252 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 18/10/16 19:40, Michael Ellerman wrote: > We have now had two nasty stack corruption bugs caused by incorrect > sizing of the return buffer for plpar_hcall()/plpar_hcall9(). > > To avoid any more such bugs, define a type which encodes the size of the > return buffer, and change the argument of plpar_hcall() to be of that > type, meaning the compiler will check for us that we passed the right > size buffer. > > There isn't an easy way to do this incrementally, without introducing a > new function name, eg. plpar_hcall_with_struct(), which is ugly as hell. > So just do it in one tree-wide change. > Conceptually looks god, but I think we need to abstract the return values as well. I'll test and see if I can send you something on top of this Balbir