X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=fs%2Fsysfs%2Ffile.c;h=c3795978b40452772f3dae70194676533bcf9832;hb=a0a4cbb171c223d60e080792b2e1e34dd529423e;hp=5d818df7250b9bae06beb67b17c70c3d8f39d8ef;hpb=b244a176be746a8f20b7d2321c48dda3710049f6;p=karo-tx-linux.git diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 5d818df7250b..c3795978b404 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -275,11 +275,10 @@ static ssize_t sysfs_write_file(struct file *file, const char __user *user_buf, { struct sysfs_open_file *of = sysfs_of(file); ssize_t len = min_t(size_t, count, PAGE_SIZE); + loff_t size = file_inode(file)->i_size; char *buf; - if (sysfs_is_bin(of->sd)) { - loff_t size = file_inode(file)->i_size; - + if (sysfs_is_bin(of->sd) && size) { if (size <= *ppos) return 0; len = min_t(ssize_t, len, size - *ppos);