open '/class/fc_transport/target7:0:0'/'node_name'
new uncached attribute '/sys/class/fc_transport/target7:0:0/node_name'
add to cache '/sys/class/fc_transport/target7:0:0/node_name'
stat '/sys/class/fc_transport/target7:0:0/node_name' failed: No such file or directory
This would allocate no space for attr->value but and the next lookup tries to
dereference a NULL pointer.
Signed-off-by: Guido Guenther <agx@sigxcpu.org>
const char *path;
char value[NAME_SIZE];
struct sysfs_attr *attr_loop;
- struct sysfs_attr *attr;
+ struct sysfs_attr *attr = NULL;
struct stat statbuf;
int fd;
ssize_t size;
list_add(&attr->node, &attr_list);
} else {
/* clear old value */
- memset(attr->value, 0x00, sizeof(attr->value));
+ if(attr->value)
+ memset(attr->value, 0x00, sizeof(attr->value));
}
if (lstat(path_full, &statbuf) != 0) {