Skip to content

cdev name comparison is wrong? #4

@jshen28

Description

@jshen28

Hello,

I have a question about the following code,

if (strncmp((char *)a, ((struct sysfs_class_device *)b)->name,
strlen((char *)a)) == 0)
return 1;

In the code, it will compare input with target using the length of input, but if input is something like host1 and there is already a node with name host12, it will mistakenly returns host12.

So my question is why not using strcmp? Thank you.

Best,
Jiatong Shen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions