Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2915526pxb; Sun, 29 Aug 2021 07:33:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7a723vv9yH+ln9PwtKbXeXIaY6KUdyH0mo7SylbCjTEbCKtK9l0D9z825NX0mpAou17go X-Received: by 2002:a92:c26f:: with SMTP id h15mr12950288ild.47.1630247600583; Sun, 29 Aug 2021 07:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630247600; cv=none; d=google.com; s=arc-20160816; b=a8bn9F6TkKoAW7n7CHT4Qh0HQpsN25h2W6gU999JUaepMG82a7aBxUDBgJnt+l+SaN DgMkB/Re/pdYb4A+8hazP6FYBUCysl7yGUh1YSFsAnhLP3zSO7aEvaxULK4ENUWoSZh3 M42VMJk+ZcZvUPmFwC+veYmoHhnXvft5HGRjAJ+YEPaHCMA9zF+tPc6miZWJr4Qwt87o 6gW7NBc30w8jstzTlh78xWMnMBtLH8wod/RqqzX8BIUoy5PVW3yY7wqlK1nMVhdMyvlA SlVnLnMhcnB/VbWuilnKMS5z9af3gG0sfJ1Covo9LGXd0AnPsI+oj2XBIunVI/IkE1/L u4jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nvs8837RL/FatuUxRpR3LhumAcLvvX9cPIPV4FvwiMY=; b=ja53fn+z5FiFihePtPIQuFlQQC+V77AcX5BWyTuhSkozGSfvuzbAxDInmxdbj/OSUv 3Sfn8TlyrGNxhNrZy2YYFvUKVhnfOOzNtCcPcmCJLgW/CH1p2sp0Mja+dH0VOYNDLKbd AlwKwGezHAMh2atjFyH2egT3sIuK1ka6srbjVfRKj8WpWV0cRViZizswEFc8Z+jgjfxT sVXf9/9KmDtsMeUuTvcSmGIDnW4xs0j/JTlG2duWhNO/G7s5EO/jklfLdNxZOJBEJXzv lfCwZNILMn4Hz8MyL9a/uuQl2dzxoKVTCgZUeDxQJp92LM6KUIVDWqNJ4BYKDFUkmeT3 H9ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=BjFyeo8J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si11453035ioa.93.2021.08.29.07.33.07; Sun, 29 Aug 2021 07:33:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=BjFyeo8J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235452AbhH2OdS (ORCPT + 99 others); Sun, 29 Aug 2021 10:33:18 -0400 Received: from mout.gmx.net ([212.227.15.18]:46603 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231791AbhH2OdP (ORCPT ); Sun, 29 Aug 2021 10:33:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1630247534; bh=nvs8837RL/FatuUxRpR3LhumAcLvvX9cPIPV4FvwiMY=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=BjFyeo8JUe3Jw+zYj7BGClvNYAj0E9f+o7JAfMNlQOS4NaNkNdNS8TDnzxpABsSLl 6Gvxk25GsS0+hxX33+3A2e5xn2w2+8D0tv8RtnGFmnc+PyEUgAtJ4R4YIP1aO6+iAz Hs1Q1T+BUjAadhrDUjivdGBtEYiR5P8RCTPOgvdw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from titan ([79.150.72.99]) by mail.gmx.net (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1N5G9n-1n392G41On-011BBk; Sun, 29 Aug 2021 16:32:14 +0200 Date: Sun, 29 Aug 2021 16:32:00 +0200 From: Len Baker To: Joe Perches Cc: Len Baker , Jonathan Corbet , Kees Cook , "Gustavo A. R. Silva" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] docs: deprecated.rst: Clarify open-coded arithmetic with literals Message-ID: <20210829143200.GA2185@titan> References: <20210827171226.2938-1-len.baker@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Provags-ID: V03:K1:FeeK8l1PQF76mrGFcok+5fvjCtP8b80O0RczVz9pQCL76eUr90Y YOqUfFd9Wu6YV5NK7NhbaEDZ5PsWH+OVf5icznT9kVfiDChGgQsdBnxO6awRVi/BDGKOhzi m/5cJjg6xXp56u6Th1uxU9hiUJYX3gn3qU9zU3use1GIkS20PCP8dMEaaKMX9yD9h4Lteyy QDQxkKHCLzszbU8IZiTug== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:BbSC90bemSE=:57FwL7S+I37KEX6nDvpsT/ MD3jACPRwaJ/PZc7PjI3vpohZjJsmNoD5iVIuz6Y2ivWWPjJMiLBGMpj8h/hDngjxOLUV6Fv6 vafjv1OjiwSj39j86Zq9iuqm1Q3/8KP3cd+Bzu55Z/s04iIHwP0CXCV8XZ5wHO1+Eq7Udlw5u gYfVKNjVtpHDpRTFl/7he8VC8J7ojvNsElkz2xwOb2R9pIttFjeLV40h7E8/+u2KwhJNuv+39 JDyJNITRWI6yE7cgAtTLAsVw0tAn2+IQvc8FMvernU7ppc5+x4nB7oRTdVqqrCNOh1EtYNPyh kOol2cDUJ1g8kILQqAAExUJi7VojOUsFYZCzJeFxz27zMLZ3Ja0vEx0HrdF7hLtONu4NPOgrH XU3HGa2mHviFDM0Nlx8ZK28sP1rqQqdO9OPJHA/WoZeNk67oBHD6JRbJWAgBJWAwGYkWrZYEL eJfG37FtDYZxM1jseG6ign4jiRkYu0nqNodm9mR7/XZJt3OO6IhZ8GnyUAH0k0PaDhoDvK/tZ /sIHrhLrKxbWF9PZDi2mIzmjIMEdf+cUnohEGmRERjWKnVORoXKfvSgQZL/cHJR91fjovMjCa u+xaPl4ebv+QIJXW2B1WCqiJBUIUZ1dFYu1dYHapqcohda8+fLWpPoZZYzvCg8PL9846vCW64 0YNumYeYjdJ3/gbkvvZkZExo3GmnUnKYcTYXbAYt2gF/lsPrXg+bw6pOwbtz/4loK1Z6G1Mju lIlXqBUhW18EP4HUFo/rX6dFxz8jDLGiw8W1F6y3hyHYJ6QF9BGiTQjT0//ThCiZ/s2xmYGtI nKFUAAZ+yVv7Mko4CO+KC7vX2by0eBJXH/GWaM5X45PUoL9CIP9Z9iDHxVIBS2cBkB7npSltu aoezIM8zVqeQ94ZhYEHMX1pNLnu4/HcOc30OM5GNVnFxIKW73XW77HFrZ0Xxh7bH2iZERCm3s NjXB2CuttKTOwPAvuBfGraf4i9VhpJmcDyoWYSLEuDwhtSJ0SyxgbXAJ/CVoVvA74kgAVxv3r XARAdMC+6TSRag6/cfN4sDVEc7tC7cDqGV8E3HzxQNHbt1fswSxU5tlAa6wHSefFRPwoYs/43 VqhbVEo2ecCwbc6uY/cm2FXajA74nL/cJHQjp8KED2luLJh9M3VewbvMw== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Aug 27, 2021 at 12:06:18PM -0700, Joe Perches wrote: > On Fri, 2021-08-27 at 19:12 +0200, Len Baker wrote: > > Although using literals for size calculation in allocator arguments ma= y > > be harmless due to compiler warnings in case of overflows, it is bette= r > > to refactor the code to avoid the use of open-coded math idiom. > > > > So, clarify the preferred way in these cases. > [] > > diff --git a/Documentation/process/deprecated.rst b/Documentation/proc= ess/deprecated.rst > [] > > @@ -60,7 +60,8 @@ smaller allocation being made than the caller was ex= pecting. Using those > > =A0allocations could lead to linear overflows of heap memory and other > > =A0misbehaviors. (One exception to this is literal values where the co= mpiler > > =A0can warn if they might overflow. Though using literals for argument= s as > > -suggested below is also harmless.) > > +suggested below is also harmless. So, the preferred way in these case= s is > > +to refactor the code to keep the open-coded math idiom out.) > > wordsmithing trivia: > > 'keep out' is difficult to parse as 'keep' is generally a positive > word but its meaning is later reversed with out. > > 'avoid ' maybe be better phrasing. > Understood. I will do this change and I will send a new version. Thanks for the review. Regards, Len