* [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() e
@ 2012-09-12 8:26 Fengguang Wu
2012-09-12 8:50 ` [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state Dan Carpenter
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Fengguang Wu @ 2012-09-12 8:26 UTC (permalink / raw)
To: Felipe Balbi; +Cc: kernel-janitors, linux-omap, linux-usb
Hi Felipe,
FYI, there are new smatch warnings show up in
tree: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git merge-result-for-greg
head: 23953bde3e4d6aa8780dc054f6ad9882ac63f4f4
commit: e918fa161f510136fce45a524e934fe20e62c8b1 [66/99] Merge tag 'gadget-for-v3.7' into merge-result-for-greg
drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() error: doing dma on the stack ((null))
drivers/usb/core/hub.c:4733 store_port_power_control() info: why not propagate 'ret' from set_port_feature() instead of -5?
drivers/usb/core/hub.c:4744 store_port_power_control() info: why not propagate 'ret' from clear_port_feature() instead of -5?
vim +2654 drivers/usb/core/hub.c
2644 return ret;
2645 }
2646
2647 static int usb_get_hub_port_power_state(struct usb_device *hdev, int port1)
2648 {
2649 struct usb_hub *hub = hdev_to_hub(hdev);
2650 struct usb_port_status data;
2651 u16 portstatus;
2652 int ret;
2653
> 2654 ret = get_port_status(hub->hdev, port1, &data);
2655 if (ret < 4) {
2656 dev_err(hub->intfdev,
2657 "%s failed (err = %d)\n", __func__, ret);
2658 if (ret >= 0)
2659 ret = -EIO;
2660 return ret;
2661 } else
2662 portstatus = le16_to_cpu(data.wPortStatus);
2663 return port_is_power_on(hub, portstatus);
2664 }
---
0-DAY kernel build testing backend Open Source Technology Centre
Fengguang Wu <wfg@linux.intel.com> Intel Corporation
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state
2012-09-12 8:26 [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() e Fengguang Wu
@ 2012-09-12 8:50 ` Dan Carpenter
2012-09-12 12:02 ` Felipe Balbi
2012-09-12 13:11 ` Alan Stern
2012-09-12 14:41 ` Lan Tianyu
2 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2012-09-12 8:50 UTC (permalink / raw)
To: Fengguang Wu
Cc: Felipe Balbi, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-usb-u79uwXL29TY76Z2rM5mHXA
On Wed, Sep 12, 2012 at 04:26:22PM +0800, Fengguang Wu wrote:
> Hi Felipe,
>
> FYI, there are new smatch warnings show up in
>
> tree: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git merge-result-for-greg
> head: 23953bde3e4d6aa8780dc054f6ad9882ac63f4f4
> commit: e918fa161f510136fce45a524e934fe20e62c8b1 [66/99] Merge tag 'gadget-for-v3.7' into merge-result-for-greg
>
> drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() error: doing dma on the stack ((null))
Smatch prints out a lot of these warnings. I haven't looked at the
rules in a while, so maybe there is a bounce buffer somewhere where
it detects stack memory and allocates a DMA'able buffer?
It would be better if the function documentation for
usb_control_msg() said that the *data pointer had to be kmalloc()ed.
Also I wonder if Documentation/DMA-API-HOWTO.txt is out of data.
Are we allowed to DMA to vmalloc()ed memory yet?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state
2012-09-12 8:50 ` [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state Dan Carpenter
@ 2012-09-12 12:02 ` Felipe Balbi
[not found] ` <20120912120211.GC5732-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2012-09-12 12:02 UTC (permalink / raw)
To: Dan Carpenter
Cc: Fengguang Wu, Felipe Balbi,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-usb-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
Hi,
On Wed, Sep 12, 2012 at 11:50:57AM +0300, Dan Carpenter wrote:
> On Wed, Sep 12, 2012 at 04:26:22PM +0800, Fengguang Wu wrote:
> > Hi Felipe,
> >
> > FYI, there are new smatch warnings show up in
> >
> > tree: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git merge-result-for-greg
> > head: 23953bde3e4d6aa8780dc054f6ad9882ac63f4f4
> > commit: e918fa161f510136fce45a524e934fe20e62c8b1 [66/99] Merge tag 'gadget-for-v3.7' into merge-result-for-greg
> >
> > drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() error: doing dma on the stack ((null))
that's not part of what I handle :-(
And merge-result-for-greg was really a temporary branch, btw :-)
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state
[not found] ` <20120912120211.GC5732-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
@ 2012-09-12 12:09 ` Fengguang Wu
0 siblings, 0 replies; 6+ messages in thread
From: Fengguang Wu @ 2012-09-12 12:09 UTC (permalink / raw)
To: Felipe Balbi
Cc: Dan Carpenter, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-usb-u79uwXL29TY76Z2rM5mHXA
On Wed, Sep 12, 2012 at 03:02:13PM +0300, Felipe Balbi wrote:
> Hi,
>
> On Wed, Sep 12, 2012 at 11:50:57AM +0300, Dan Carpenter wrote:
> > On Wed, Sep 12, 2012 at 04:26:22PM +0800, Fengguang Wu wrote:
> > > Hi Felipe,
> > >
> > > FYI, there are new smatch warnings show up in
> > >
> > > tree: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git merge-result-for-greg
> > > head: 23953bde3e4d6aa8780dc054f6ad9882ac63f4f4
> > > commit: e918fa161f510136fce45a524e934fe20e62c8b1 [66/99] Merge tag 'gadget-for-v3.7' into merge-result-for-greg
> > >
> > > drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() error: doing dma on the stack ((null))
>
> that's not part of what I handle :-(
>
> And merge-result-for-greg was really a temporary branch, btw :-)
No problem. I'll stop testing this branch :)
Thanks,
Fengguang
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state
2012-09-12 8:26 [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() e Fengguang Wu
2012-09-12 8:50 ` [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state Dan Carpenter
@ 2012-09-12 13:11 ` Alan Stern
2012-09-12 14:41 ` Lan Tianyu
2 siblings, 0 replies; 6+ messages in thread
From: Alan Stern @ 2012-09-12 13:11 UTC (permalink / raw)
To: kernel-janitors
On Wed, 12 Sep 2012, Fengguang Wu wrote:
> Hi Felipe,
>
> FYI, there are new smatch warnings show up in
>
> tree: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git merge-result-for-greg
> head: 23953bde3e4d6aa8780dc054f6ad9882ac63f4f4
> commit: e918fa161f510136fce45a524e934fe20e62c8b1 [66/99] Merge tag 'gadget-for-v3.7' into merge-result-for-greg
>
> drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() error: doing dma on the stack ((null))
> drivers/usb/core/hub.c:4733 store_port_power_control() info: why not propagate 'ret' from set_port_feature() instead of -5?
> drivers/usb/core/hub.c:4744 store_port_power_control() info: why not propagate 'ret' from clear_port_feature() instead of -5?
>
> vim +2654 drivers/usb/core/hub.c
> 2644 return ret;
> 2645 }
> 2646
> 2647 static int usb_get_hub_port_power_state(struct usb_device *hdev, int port1)
> 2648 {
> 2649 struct usb_hub *hub = hdev_to_hub(hdev);
> 2650 struct usb_port_status data;
> 2651 u16 portstatus;
> 2652 int ret;
> 2653
> > 2654 ret = get_port_status(hub->hdev, port1, &data);
> 2655 if (ret < 4) {
> 2656 dev_err(hub->intfdev,
> 2657 "%s failed (err = %d)\n", __func__, ret);
> 2658 if (ret >= 0)
> 2659 ret = -EIO;
> 2660 return ret;
> 2661 } else
> 2662 portstatus = le16_to_cpu(data.wPortStatus);
> 2663 return port_is_power_on(hub, portstatus);
> 2664 }
This is a real problem. It looks like it really is necessary to call
hub_port_status() here, not get_port_status(). Would you like to fix
this?
The reason for changing the return codes from clear_port_feature() and
set_port_feature() is simple. The values they return are meant for
internal use within the kernel, whereas the return code from
store_port_power_control() will be passed back to userspace.
Alan Stern
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state
2012-09-12 8:26 [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() e Fengguang Wu
2012-09-12 8:50 ` [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state Dan Carpenter
2012-09-12 13:11 ` Alan Stern
@ 2012-09-12 14:41 ` Lan Tianyu
2 siblings, 0 replies; 6+ messages in thread
From: Lan Tianyu @ 2012-09-12 14:41 UTC (permalink / raw)
To: kernel-janitors
On 2012/9/12 21:11, Alan Stern wrote:
> On Wed, 12 Sep 2012, Fengguang Wu wrote:
>
>> Hi Felipe,
>>
>> FYI, there are new smatch warnings show up in
>>
>> tree: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git merge-result-for-greg
>> head: 23953bde3e4d6aa8780dc054f6ad9882ac63f4f4
>> commit: e918fa161f510136fce45a524e934fe20e62c8b1 [66/99] Merge tag 'gadget-for-v3.7' into merge-result-for-greg
>>
>> drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() error: doing dma on the stack ((null))
>> drivers/usb/core/hub.c:4733 store_port_power_control() info: why not propagate 'ret' from set_port_feature() instead of -5?
>> drivers/usb/core/hub.c:4744 store_port_power_control() info: why not propagate 'ret' from clear_port_feature() instead of -5?
>>
>> vim +2654 drivers/usb/core/hub.c
>> 2644 return ret;
>> 2645 }
>> 2646
>> 2647 static int usb_get_hub_port_power_state(struct usb_device *hdev, int port1)
>> 2648 {
>> 2649 struct usb_hub *hub = hdev_to_hub(hdev);
>> 2650 struct usb_port_status data;
>> 2651 u16 portstatus;
>> 2652 int ret;
>> 2653
>>> 2654 ret = get_port_status(hub->hdev, port1, &data);
>> 2655 if (ret < 4) {
>> 2656 dev_err(hub->intfdev,
>> 2657 "%s failed (err = %d)\n", __func__, ret);
>> 2658 if (ret >= 0)
>> 2659 ret = -EIO;
>> 2660 return ret;
>> 2661 } else
>> 2662 portstatus = le16_to_cpu(data.wPortStatus);
>> 2663 return port_is_power_on(hub, portstatus);
>> 2664 }
>
> This is a real problem. It looks like it really is necessary to call
> hub_port_status() here, not get_port_status(). Would you like to fix
> this?
>
Yeah. I'd like to fix it.
> The reason for changing the return codes from clear_port_feature() and
> set_port_feature() is simple. The values they return are meant for
> internal use within the kernel, whereas the return code from
> store_port_power_control() will be passed back to userspace.
>
> Alan Stern
>
--
Best Regards
Tianyu Lan
linux kernel enabling team
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-09-12 14:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-12 8:26 [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state() e Fengguang Wu
2012-09-12 8:50 ` [balbi-usb:merge-result-for-greg 66/99] drivers/usb/core/hub.c:2654 usb_get_hub_port_power_state Dan Carpenter
2012-09-12 12:02 ` Felipe Balbi
[not found] ` <20120912120211.GC5732-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2012-09-12 12:09 ` Fengguang Wu
2012-09-12 13:11 ` Alan Stern
2012-09-12 14:41 ` Lan Tianyu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).