mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 03:40:05 +01:00
Add some fixes and workarounds for gcc-11 static analyzer.
Not everything is a real bug (false positive rate is very high here), but the code is actually more readable.
This commit is contained in:
@@ -162,6 +162,9 @@ static int device_ready(struct crypt_device *cd, struct device *device)
|
||||
struct stat st;
|
||||
size_t tmp_size;
|
||||
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
|
||||
if (device->o_direct) {
|
||||
log_dbg(cd, "Trying to open and read device %s with direct-io.",
|
||||
device_path(device));
|
||||
@@ -217,6 +220,9 @@ static int _open_locked(struct crypt_device *cd, struct device *device, int flag
|
||||
{
|
||||
int fd;
|
||||
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
|
||||
log_dbg(cd, "Opening locked device %s", device_path(device));
|
||||
|
||||
if ((flags & O_ACCMODE) != O_RDONLY && device_locked_readonly(device->lh)) {
|
||||
|
||||
Reference in New Issue
Block a user