mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
IB/core: Don't use is_async in event files to infer events size
Previously, we inferred the events size in ib_uverbs_event_read by
using the is_async flag. Instead of that, we pass the event size
directly.
Fixes: 1e7710f3f6
('IB/core: Change completion channel to use the reworked objects schema')
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
c52d8114d1
commit
e0fcc61113
@ -257,10 +257,9 @@ static ssize_t ib_uverbs_event_read(struct ib_uverbs_event_file *file,
|
|||||||
struct ib_uverbs_file *uverbs_file,
|
struct ib_uverbs_file *uverbs_file,
|
||||||
struct file *filp, char __user *buf,
|
struct file *filp, char __user *buf,
|
||||||
size_t count, loff_t *pos,
|
size_t count, loff_t *pos,
|
||||||
bool is_async)
|
size_t eventsz)
|
||||||
{
|
{
|
||||||
struct ib_uverbs_event *event;
|
struct ib_uverbs_event *event;
|
||||||
int eventsz;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
spin_lock_irq(&file->lock);
|
spin_lock_irq(&file->lock);
|
||||||
@ -290,11 +289,6 @@ static ssize_t ib_uverbs_event_read(struct ib_uverbs_event_file *file,
|
|||||||
|
|
||||||
event = list_entry(file->event_list.next, struct ib_uverbs_event, list);
|
event = list_entry(file->event_list.next, struct ib_uverbs_event, list);
|
||||||
|
|
||||||
if (is_async)
|
|
||||||
eventsz = sizeof (struct ib_uverbs_async_event_desc);
|
|
||||||
else
|
|
||||||
eventsz = sizeof (struct ib_uverbs_comp_event_desc);
|
|
||||||
|
|
||||||
if (eventsz > count) {
|
if (eventsz > count) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
event = NULL;
|
event = NULL;
|
||||||
@ -326,7 +320,8 @@ static ssize_t ib_uverbs_async_event_read(struct file *filp, char __user *buf,
|
|||||||
struct ib_uverbs_async_event_file *file = filp->private_data;
|
struct ib_uverbs_async_event_file *file = filp->private_data;
|
||||||
|
|
||||||
return ib_uverbs_event_read(&file->ev_file, file->uverbs_file, filp,
|
return ib_uverbs_event_read(&file->ev_file, file->uverbs_file, filp,
|
||||||
buf, count, pos, true);
|
buf, count, pos,
|
||||||
|
sizeof(struct ib_uverbs_async_event_desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t ib_uverbs_comp_event_read(struct file *filp, char __user *buf,
|
static ssize_t ib_uverbs_comp_event_read(struct file *filp, char __user *buf,
|
||||||
@ -337,7 +332,8 @@ static ssize_t ib_uverbs_comp_event_read(struct file *filp, char __user *buf,
|
|||||||
|
|
||||||
return ib_uverbs_event_read(&comp_ev_file->ev_file,
|
return ib_uverbs_event_read(&comp_ev_file->ev_file,
|
||||||
comp_ev_file->uobj_file.ufile, filp,
|
comp_ev_file->uobj_file.ufile, filp,
|
||||||
buf, count, pos, false);
|
buf, count, pos,
|
||||||
|
sizeof(struct ib_uverbs_comp_event_desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int ib_uverbs_event_poll(struct ib_uverbs_event_file *file,
|
static unsigned int ib_uverbs_event_poll(struct ib_uverbs_event_file *file,
|
||||||
|
Loading…
Reference in New Issue
Block a user