lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcxaSXeMNmkPoMnA+zjp+JWmHp5aE+2yPhXaqxMC6QWEQ@mail.gmail.com>
Date:   Tue, 17 Jan 2023 20:08:01 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Brent Pappas <bpappas@...pasbrent.com>
Cc:     andy@...nel.org, ailus@...ux.intel.com, error27@...il.com,
        gregkh@...uxfoundation.org, hdegoede@...hat.com,
        linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
        linux-staging@...ts.linux.dev, mchehab@...nel.org
Subject: Re: [PATCH v2] media: atomisp: pci: Replace bytes macros with functions

On Tue, Jan 17, 2023 at 6:17 PM Brent Pappas <bpappas@...pasbrent.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@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ