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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXjA7q-v-mYY9DChC0XQbv9vfW6c3Vfn07-H-FgBr+izA@mail.gmail.com>
Date:   Wed, 16 Sep 2020 09:06:06 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Mauro Carvalho Chehab <mchehab@...nel.org>
Cc:     "Daniel W. S. Almeida" <dwlsalmeida@...il.com>,
        r.verdejo@...sung.com,
        Linux Media Mailing List <linux-media@...r.kernel.org>,
        nicolas@...fresne.ca, Shuah Khan <skhan@...uxfoundation.org>,
        linux-kernel-mentees@...ts.linuxfoundation.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Randy Dunlap <rdunlap@...radead.org>
Subject: Re: [PATCH] media: vidtv: fix build on 32bit architectures

Hi Mauro, Daniel,

On Wed, Sep 16, 2020 at 8:40 AM Mauro Carvalho Chehab
<mchehab@...nel.org> wrote:
> Em Tue, 15 Sep 2020 15:05:09 -0300
> "Daniel W. S. Almeida" <dwlsalmeida@...il.com> escreveu:
> > From: Daniel W. S. Almeida <dwlsalmeida@...il.com>
> >
> > Fix the following error for builds on 32bit architectures:
> >
> > ERROR: modpost: "__udivdi3"
> > [drivers/media/test-drivers/vidtv/dvb-vidtv-bridge.ko] undefined!
> >
> > Which is due to 64bit divisions that did not go through the helpers
> > in linux/math64.h
> >
> > As vidtv_mux_check_mux_rate was not operational in its current form,
> > drop the entire function  while it is not fixed properly.
> >
> > For now, call vidtv_mux_pad_with_nulls with a constant number of packets
> > to avoid warnings due to unused functions when building this driver.
> >
> > Fixes: f90cf6079bf67988 ("media: vidtv: add a bridge driver")
> > Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@...il.com>

Acked-by: Geert Uytterhoeven <geert@...ux-m68k.org> # build-tested

> > --- a/drivers/media/test-drivers/vidtv/vidtv_s302m.c
> > +++ b/drivers/media/test-drivers/vidtv/vidtv_s302m.c
> > @@ -285,12 +285,12 @@ static void vidtv_s302m_compute_pts(struct vidtv_encoder *e)
> >  {
> >       u64 count = e->sample_count;
> >       struct vidtv_access_unit *au = e->access_units;
> > +     u32 duration = CLOCK_UNIT_90KHZ / e->sampling_rate_hz;
> >
> >       while (au) {
> >               count += au->num_samples;
> >
> > -             au->pts = count *
> > -                       CLOCK_UNIT_90KHZ / e->sampling_rate_hz;
> > +             au->pts = count * duration;
>
> That doesn't seem to be the right thing to do here.
>
> Assuming that sampling rate is 48 kHz, you'll
> have duration = 1.875, which would be rounded to 1.
>
> In other words, the above is identical to:
>
>         au->pts = count
>
> Now, I don't know from where that CLOCK_UNIT_90KHZ came from.
>
> If such constant is not needed anymore, just drop it.
>
> If, on the other hand, this is required by the specs, then
> you may need to do a 64 bits division, e. g. using
> div64_u64() or do_div().

As vidtv_encoder.sampling_rate_hz is u32, there's fortunately no need
to use div64_u64() (64-by-64), so div_u64() (64-by-32) is fine.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ