On Sat, 8 Feb 2025 18:26:12 +0100
Xabier Oneca  --  xOneca <[email protected]> wrote:

> Hi Anton,
> 
> Thanks for the patch.
> 
> > Report of the static analyzer:
> > DIVISION_BY_ZERO.EX Variable xatou(...),
> > whose possible value set allows a zero value at xatonum_template.c:118 by 
> > calling function 'xatou' at beep.c:90,
> > is used as a denominator at beep.c:90.
> >
> > Corrections explained:
> > - If xatou(optarg) returns 0, freq is set to 440 instead of
> >   terminating the program.
> > - A warning message is printed to inform the user about the change.
> 
> Not anymore, no? ;)
HI,
No, because beep does not warn, it sets 440 as default:

beep -f 0
beep -f 0 --debug
beep: Verbose: evdev driver_detect 0x5654ca4f5700 (nil)
beep: Verbose: b-lib: opened /dev/input/by-path/platform-pcspkr-event-spkr as 3
beep: Verbose: beep: using driver 0x5654ca4f5700 (name=evdev, fd=3, 
dev=/dev/input/by-path/platform-pcspkr-event-spkr)
beep: Verbose: 1 times 200 ms beeps (100 ms delay between, 0 ms delay after) @ 
440 Hz
beep: Verbose: evdev driver_begin_tone 0x5654ca4f5700 440
beep: Verbose: evdev driver_end_tone 0x5654ca4f5700
beep: Verbose: evdev driver_end_tone 0x5654ca4f5700
beep: Verbose: evdev driver_fini 0x5654ca4f5700

Ciao,
Tito

> 
> > - Removed redundant second call to xatou(optarg), using freq
> >
> > Triggers found by static analyzer Svace.
> >
> > Signed-off-by: Anton Moryakov <[email protected]>
> 
> Cheers,
> 
> Xabier Oneca_,,_
> _______________________________________________
> busybox mailing list
> [email protected]
> https://lists.busybox.net/mailman/listinfo/busybox

_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to