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 <bpappas@xxxxxxxxxxxxxxx> > --- > 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