Bug 1250768

Summary: warning: 'sizeof' on array function parameter 'tx_stream_indices' will return size of 'const uint32_t* {aka const unsigned int*}' [-Wsizeof-array-argument]
Product: [Fedora] Fedora Reporter: Jonathan Wakely <jwakely>
Component: uhdAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: jskarvad
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: uhd-3.10.1.0-1.fc25 uhd-3.10.1.0-1.fc24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-05 21:41:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Untested patch to deduce the array length. none

Description Jonathan Wakely 2015-08-06 01:07:32 UTC
In file included from /builddir/build/BUILD/uhd-release_003_008_002/host/include/uhd/transport/nirio/niriok_proxy.h:27:0,
                 from /builddir/build/BUILD/uhd-release_003_008_002/host/include/uhd/transport/nirio/niusrprio_session.h:24,
                 from /builddir/build/BUILD/uhd-release_003_008_002/host/utils/usrp_x3xx_fpga_burner.cpp:43:
/builddir/build/BUILD/uhd-release_003_008_002/host/include/uhd/transport/nirio/nirio_quirks.h: In member function 'void uhd::niusrprio::nirio_quirks::register_tx_streams(const uint32_t*)':
/builddir/build/BUILD/uhd-release_003_008_002/host/include/uhd/transport/nirio/nirio_quirks.h:39:56: warning: 'sizeof' on array function parameter 'tx_stream_indices' will return size of 'const uint32_t* {aka const unsigned int*}' [-Wsizeof-array-argument]
         for (size_t i = 0; i < sizeof(tx_stream_indices)/sizeof(*tx_stream_indices); i++) {
                                                        ^
/builddir/build/BUILD/uhd-release_003_008_002/host/include/uhd/transport/nirio/nirio_quirks.h:38:74: note: declared here
     UHD_INLINE void register_tx_streams(const uint32_t tx_stream_indices[]) {
                                                                          ^

This looks like a real bug.

sizeof(tx_stream_indices)/sizeof(*tx_stream_indices) cannot possibly do anything useful.

It will work by change on 64-bit targets because the only caller of that function (in host/lib/usrp/x300/x300_impl.cpp) passes an array of two elements, and sizeof(uint32_t*)/sizeof(uint32_t) == 2 for 64-bit targets, but for 32-bit targets == 1, so only the first stream will be registered.

Either the caller should pass in the array length or the function should be turned into a template so it can deduce the length.

Comment 1 Jonathan Wakely 2015-08-06 01:08:01 UTC
Created attachment 1059687 [details]
Untested patch to deduce the array length.

Comment 2 Jan Kurik 2016-02-24 13:34:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 3 Fedora Update System 2016-11-23 14:56:09 UTC
gr-osmosdr-0.1.3-23.20141023git42c66fdd.fc25 gnuradio-3.7.10.1-4.fc25 uhd-3.10.1.0-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-36549ad39b

Comment 4 Fedora Update System 2016-11-23 16:03:02 UTC
gr-osmosdr-0.1.3-23.20141023git42c66fdd.fc24 gnuradio-3.7.10.1-4.fc24 uhd-3.10.1.0-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-a90a2cee2c

Comment 5 Fedora Update System 2016-11-25 09:39:16 UTC
gnuradio-3.7.10.1-4.fc24, gr-osmosdr-0.1.3-23.20141023git42c66fdd.fc24, uhd-3.10.1.0-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-a90a2cee2c

Comment 6 Fedora Update System 2016-11-25 09:42:03 UTC
gnuradio-3.7.10.1-4.fc25, gr-osmosdr-0.1.3-23.20141023git42c66fdd.fc25, uhd-3.10.1.0-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-36549ad39b

Comment 7 Fedora Update System 2016-12-05 21:41:21 UTC
gnuradio-3.7.10.1-4.fc25, gr-osmosdr-0.1.3-23.20141023git42c66fdd.fc25, uhd-3.10.1.0-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2016-12-06 10:25:21 UTC
gnuradio-3.7.10.1-4.fc24, gr-osmosdr-0.1.3-23.20141023git42c66fdd.fc24, uhd-3.10.1.0-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.