From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6323EC38159 for ; Wed, 18 Jan 2023 15:01:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231599AbjARPBx (ORCPT ); Wed, 18 Jan 2023 10:01:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbjARPBR (ORCPT ); Wed, 18 Jan 2023 10:01:17 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 346CA37F0B; Wed, 18 Jan 2023 06:56:30 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id k16so4237483wms.2; Wed, 18 Jan 2023 06:56:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MaU4xcoIvuYlrJkvIksCMnsfWTJ9NQrt07UqgdSvUt8=; b=cjAdENS67WVP+1GqCou7olNn5RC35WH4WRlkKDbs/3IG/+oHzdd58hv3xbOgmXydgy RuG6uQW4Mml1SuomuHGOYsfyCRqcZ4WqDfzck0ooA+VcKNodUAi7mMq5zeJkSbsa3E6y P/UT7PL9AANkKuYjuVapWLwst1YI7WzELKpB5zqFdB1fP9jQhEmh4QayDcnD1JHKCsn2 oMW8mC8Y9WVh63P0n2tgfgTGSBmnDChnX8JNe52D76/5HDqRuZ18Ux8HfFlQLy+a+d4V yjAcAwDkcAYWAuu00c+ESEOSZai3UUnTAq7oUXCocGHgZ4s/x4Lzvwn/4nAkHJPj4puy QMSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MaU4xcoIvuYlrJkvIksCMnsfWTJ9NQrt07UqgdSvUt8=; b=0iTFqWTnyu/Ro09jS4u/nL8hOmpcjGVVcWkI0UXyYMWInDEDI56pJ9Ert7ifIWvJi3 5Qt/HUb4tM5EJ6TeXM9Z7LGXrxhzDVxX7B2SfkSt4vBdFcZ0F6V+k1EH3Z2Ab2Q/V3LL adewPH4LFJOm1k7awZOgH7bBdeB2ZGHuDyr8OIn7PCYfV7hcLLUPRUmc01m1FH+85Wt4 Vxq0NB9PMdCbBO4oKIAFhnsfAyyWYMHUBVz1pJT37ECtv14OJShNJeYZV4G2FPIXe7+a YnmzCbzLe6gxNsjnHYNzHLfEISdgTBA46hLdG+vL0sjEhUxV2/v+P6AXVxzB76PjTnd8 6huQ== X-Gm-Message-State: AFqh2koNPmCqlfsTIEpicaM0x5Y2HTWY6VU9HwcAqRDYs4oAUQtkDRoD l+NgG3Hrkb/uVWfFRBao/Ug= X-Google-Smtp-Source: AMrXdXs8GnprtjlQg8wOe27VuMXLmamnap+2Vh2Z5ePwcvK++/uQ0cMcbw/Mooxb6Q+yt5LCzwdEmw== X-Received: by 2002:a05:600c:ad0:b0:3d9:ebab:ccff with SMTP id c16-20020a05600c0ad000b003d9ebabccffmr15616483wmr.33.1674053788750; Wed, 18 Jan 2023 06:56:28 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id l11-20020a1ced0b000000b003dafb0c8dfbsm2674533wmh.14.2023.01.18.06.56.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 06:56:28 -0800 (PST) Date: Wed, 18 Jan 2023 17:56:24 +0300 From: Dan Carpenter To: Brent Pappas Cc: andy.shevchenko@gmail.com, ailus@linux.intel.com, gregkh@linuxfoundation.org, hdegoede@redhat.com, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mchehab@kernel.org Subject: Re: [PATCH v4] media: atomisp: pci: Replace bytes macros with functions Message-ID: References: <20230118144226.13127-1-bpappas@pappasbrent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230118144226.13127-1-bpappas@pappasbrent.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Wed, Jan 18, 2023 at 09:42:26AM -0500, Brent Pappas wrote: > Replace the function-like macros FPNTBL_BYTES(), SCTBL_BYTES(), and > MORPH_PLANE_BYTES() with functions to comply with Linux coding style > standards. > Replace multiplication with calls to functions/macros from overflow.h > to prevent accidental arithmetic overflow. > > Signed-off-by: Brent Pappas > --- > Changelog: > V1 -> V2: Use size_mul() to perform size_t multiplication without risk of > overflow. > Remove the inline keyword from function definitions. > > V2 -> V3: Add commit message. > > V3 -> V4: Use array_size() and array3_size() for multiplication. > > .../staging/media/atomisp/pci/sh_css_params.c | 38 +++++++++++-------- > 1 file changed, 23 insertions(+), 15 deletions(-) > > diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c > index f08564f58242..7e111df5c09d 100644 > --- a/drivers/staging/media/atomisp/pci/sh_css_params.c > +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c > @@ -98,17 +98,27 @@ > #include "sh_css_frac.h" > #include "ia_css_bufq.h" > > -#define FPNTBL_BYTES(binary) \ > - (sizeof(char) * (binary)->in_frame_info.res.height * \ > - (binary)->in_frame_info.padded_width) > +static size_t fpntbl_bytes(const struct ia_css_binary *binary) > +{ > + return array3_size(sizeof(char), > + binary->in_frame_info.res.height, > + binary->in_frame_info.padded_width); This indenting is not correct. Do it the way that checkpatch.pl likes: return array3_size(sizeof(char), binary->in_frame_info.res.height, binary->in_frame_info.padded_width); [tab][tab][tab][space][space][space]binary->in_frame_info.res.height, [tab][tab][tab][space][space][space]binary->in_frame_info.padded_width); (Same for the rest obviously) regards, dan carpenter