while (backends[i]) {
if (sysfs_streq(comp, backends[i]->name))
- sz += sprintf(buf + sz, "[%s] ", backends[i]->name);
+ sz += scnprintf(buf + sz, PAGE_SIZE - sz - 2,
+ "[%s] ", backends[i]->name);
else
- sz += sprintf(buf + sz, "%s ", backends[i]->name);
+ sz += scnprintf(buf + sz, PAGE_SIZE - sz - 2,
+ "%s ", backends[i]->name);
i++;
}
- sz += sprintf(buf + sz, "\n");
+ sz += scnprintf(buf + sz, PAGE_SIZE - sz, "\n");
return sz;
}
struct device_attribute *attr, char *b) \
{ \
struct zram *zram = dev_to_zram(d); \
- return sprintf(b, "%llu\n", \
+ return scnprintf(b, PAGE_SIZE, "%llu\n", \
(u64)atomic64_read(&zram->stats.name)); \
} \
static struct device_attribute dev_attr_##name = \
{
struct zram *zram = dev_to_zram(dev);
- return sprintf(buf, "%llu\n", zram->disksize);
+ return scnprintf(buf, PAGE_SIZE, "%llu\n", zram->disksize);
}
static ssize_t initstate_show(struct device *dev,
val = init_done(zram);
up_read(&zram->init_lock);
- return sprintf(buf, "%u\n", val);
+ return scnprintf(buf, PAGE_SIZE, "%u\n", val);
}
static ssize_t orig_data_size_show(struct device *dev,
{
struct zram *zram = dev_to_zram(dev);
- return sprintf(buf, "%llu\n",
+ return scnprintf(buf, PAGE_SIZE, "%llu\n",
(u64)(atomic64_read(&zram->stats.pages_stored)) << PAGE_SHIFT);
}
val = zs_get_total_size_bytes(meta->mem_pool);
up_read(&zram->init_lock);
- return sprintf(buf, "%llu\n", val);
+ return scnprintf(buf, PAGE_SIZE, "%llu\n", val);
}
static ssize_t max_comp_streams_show(struct device *dev,
val = zram->max_comp_streams;
up_read(&zram->init_lock);
- return sprintf(buf, "%d\n", val);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", val);
}
static ssize_t max_comp_streams_store(struct device *dev,