Signed-off-by: Akinobu Mita Cc: Greg Kroah-Hartman --- drivers/base/firmware_class.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) Index: 2.6-git/drivers/base/firmware_class.c =================================================================== --- 2.6-git.orig/drivers/base/firmware_class.c +++ 2.6-git/drivers/base/firmware_class.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "base.h" @@ -176,7 +177,7 @@ firmware_data_read(struct kobject *kobj, struct device *dev = to_dev(kobj); struct firmware_priv *fw_priv = dev_get_drvdata(dev); struct firmware *fw; - ssize_t ret_count = count; + ssize_t ret_count; mutex_lock(&fw_lock); fw = fw_priv->fw; @@ -184,14 +185,8 @@ firmware_data_read(struct kobject *kobj, ret_count = -ENODEV; goto out; } - if (offset > fw->size) { - ret_count = 0; - goto out; - } - if (offset + ret_count > fw->size) - ret_count = fw->size - offset; - - memcpy(buffer, fw->data + offset, ret_count); + ret_count = memory_read_from_buffer(buffer, count, &offset, + fw->data, fw->size); out: mutex_unlock(&fw_lock); return ret_count; -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/