On Tue, Jan 17, 2023 at 6:17 PM Brent Pappas <bpappas@xxxxxxxxxxxxxxx> 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@xxxxxxxxx) 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