Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#11612 closed Patch - Bug Fix (fixed)

Patch to check the return value from posix_fadvise in fileringbuffer.cpp - fixes coverity 746748 and 766747

Reported by: Gary Buhrmaster <gary.buhrmaster@…> Owned by: Gary Buhrmaster <gary.buhrmaster@…>
Priority: minor Milestone: 0.27
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Static analysis determined that the return value from posix_fadvise was not checked. Check the return, and log if failed (only debug level logging, since fadvise should never fail in the first place, and if it does fail it should not matter (it is, after all, only a hint) but if debugging, the failure might tell one something).

Fixes coverity 746748 and 746747

github ref: https://github.com/garybuhrmaster/mythtv/commit/e6bbaf778585fd2b8f930d61164cfe0622744d93

github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/e6bbaf778585fd2b8f930d61164cfe0622744d93.patch

Change History (4)

comment:1 Changed 5 years ago by danielk

If these advisory calls don't work we don't really want to spam the logs. They are just intended to give the operating system a heads up if it supports it.

comment:2 Changed 5 years ago by Gary Buhrmaster <gary.buhrmaster@…>

Since the only errors returned per the spec (which would only result in logs if running at the file debug level anyway) will occur with a programming error (bad fd, bad advise option specification), the logs would not be spammed (unless there is something else seriously broken in some new codes). fadvise does not return an error if it simply decides to ignore the offset/sizes (it simple ignores the advise, and moves on), so logs would never be generated in those cases.

comment:3 Changed 5 years ago by Gary Buhrmaster <gary.buhrmaster@…>

Owner: set to Gary Buhrmaster <gary.buhrmaster@…>
Resolution: fixed
Status: newclosed

In 351c36ac73d664a370b9b12c655604c03ba71ca1/mythtv:

Check the return value from posix_fadvise

Static analysis determined that the return value
from posix_fadvise was not checked. Check the
return, and log if failed (only debug level
logging, since fadvise should never fail in the
first place, and if it does fail it should not
matter (it is, after all, only a hint) but if
debugging, the failure might tell one something).

Fixes coverity 746748 and 746747

Fixes #11612.

Signed-off-by: Paul Harrison <pharrison@…>

comment:4 Changed 5 years ago by paulh

Milestone: unknown0.27
Note: See TracTickets for help on using tickets.