From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: [PATCH v2 1/3] overflow.h: Add arithmetic shift helper Date: Wed, 1 Aug 2018 10:57:44 +0300 Message-ID: <20180801075744.qpppbaywp5dklxul@mwanda> References: <20180801000039.44314-1-keescook@chromium.org> <20180801000039.44314-2-keescook@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20180801000039.44314-2-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org To: Kees Cook Cc: Rasmus Villemoes , Jason Gunthorpe , Leon Romanovsky , Jason Gunthorpe , Leon Romanovsky , Bart Van Assche , Doug Ledford , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org List-Id: linux-rdma@vger.kernel.org The idea is nice, but I don't like the API. The "_overflow" feels too specific because maybe we could check for other things in the future. Normally boolean macros should say they are boolean in the name and I would prefer if it returned zero on failure. if (!checked_shift(dest, mask, shift)) { if (!shift_ok(dest, mask, shift)) { if (!safe_shift(dest, mask, shift)) { regards, dan carpenter