Skip to content

Commit

Permalink
media: staging: atomisp: fix string comparation logic
Browse files Browse the repository at this point in the history
it makes no sense to use strncmp() with a size with is
bigger than the string we're comparing with.

Fix those warnings:

    drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c:776 atomisp_open() error: strncmp() '"ATOMISP ISP ACC"' too small (16 vs 32)
    drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c:913 atomisp_release() error: strncmp() '"ATOMISP ISP ACC"' too small (16 vs 32)
    drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c:2751 atomisp_vidioc_default() error: strncmp() '"ATOMISP ISP ACC"' too small (16 vs 32)

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
  • Loading branch information
Mauro Carvalho Chehab committed Apr 17, 2018
1 parent 90d53d1 commit 65c1167
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,7 @@ static int atomisp_open(struct file *file)

rt_mutex_lock(&isp->mutex);

acc_node = !strncmp(vdev->name, "ATOMISP ISP ACC",
sizeof(vdev->name));
acc_node = !strcmp(vdev->name, "ATOMISP ISP ACC");
if (acc_node) {
acc_pipe = atomisp_to_acc_pipe(vdev);
asd = acc_pipe->asd;
Expand Down Expand Up @@ -910,8 +909,7 @@ static int atomisp_release(struct file *file)
rt_mutex_lock(&isp->mutex);

dev_dbg(isp->dev, "release device %s\n", vdev->name);
acc_node = !strncmp(vdev->name, "ATOMISP ISP ACC",
sizeof(vdev->name));
acc_node = !strcmp(vdev->name, "ATOMISP ISP ACC");
if (acc_node) {
acc_pipe = atomisp_to_acc_pipe(vdev);
asd = acc_pipe->asd;
Expand Down
3 changes: 1 addition & 2 deletions drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2748,8 +2748,7 @@ static long atomisp_vidioc_default(struct file *file, void *fh,
bool acc_node;
int err;

acc_node = !strncmp(vdev->name, "ATOMISP ISP ACC",
sizeof(vdev->name));
acc_node = !strcmp(vdev->name, "ATOMISP ISP ACC");
if (acc_node)
asd = atomisp_to_acc_pipe(vdev)->asd;
else
Expand Down

0 comments on commit 65c1167

Please sign in to comment.