lkml.org 
[lkml]   [2023]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] media: atomisp: pci: Replace bytes macros with functions
On Tue, Jan 17, 2023 at 6:17 PM Brent Pappas <bpappas@pappasbrent.com> wrote:
>
> Thank you for the advice Andy.
> I took a look in overflow.h and found the size_mul function, I assume this
> is what I should be using to prevent accidental overflow.
> I also removed the inline keyword from the function definitions because
> Dan (error27@gmail.com) recommended that I do so in reply to an earlier
> patch I submitted.

Now you need to properly form a commit message. What you have done
above is good for the comment (goes near to changelog).

...

> +static size_t fpntbl_bytes(const struct ia_css_binary *binary)
> +{
> + return size_mul(sizeof(char),
> + size_mul(binary->in_frame_info.res.height,
> + binary->in_frame_info.padded_width));

I recommend using array_size() and array3_size() rather than open coding them.

> +}

...

> + return size_mul(sizeof(unsigned short),

> + size_mul(binary->sctbl_height,
> + size_mul(binary->sctbl_aligned_width_per_color,
> + IA_CSS_SC_NUM_COLORS)));

array3_size()

and so on.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2023-03-26 23:44    [W:0.059 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site