spice/server
Frediano Ziglio 6be1c2f839 stat-file: Avoid compiler warning
Some gcc version reports this error:

stat-file.c: In function 'stat_file_add_node':
stat-file.c:180:15: error: 'node' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
     g_strlcpy(node->name, name, sizeof(node->name));
               ^~~~
cc1: all warnings being treated as errors

This warning is a false positive as this loop:
    for (ref = 0; ref <= stat_file->max_nodes; ref++) {
        node = &stat_file->stat->nodes[ref];
        ...
    }
will always iterate at least once.

This patch rewrite the loop in order to make more compilers
understand that node variable is always initialized.

There are two checks apparently removed in the patch:
- check for stat_file->stat not being NULL. This was worthless as the
  field was already used in the function. Also this field is never
  NULL (unless memory corruption happened);
- stat_file->stat->num_of_nodes >= stat_file->max_nodes. It's implicit
  in the loop. If num_of_nodes >= max_nodes means that there are no
  free nodes so all nodes should have SPICE_STAT_NODE_FLAG_ENABLED set,
  loop will exit and function will return INVALID_STAT_REF.

Reported-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-02-03 18:13:22 +00:00
..
tests autotools: compile gst-test only if gstreamer is available 2017-02-03 09:08:55 +01:00
.gitignore gitignore: Reuse top-level gitignore 2016-12-14 19:09:21 +00:00
agent-msg-filter.c agent-msg-filter: Remove extra headers 2016-10-11 13:41:37 +01:00
agent-msg-filter.h agent-filter: Use enum as return value 2016-09-16 11:54:56 +01:00
cache-item.h Move RedCacheItem size field inside cache_data union 2016-05-25 09:53:57 +01:00
cache-item.tmpl.c Use SPICE_VERIFY macro for RHEL6 compatibility 2016-11-14 17:22:02 +00:00
char-device.c marshaller: rename _add_ref() to _add_by_ref() 2016-12-08 14:05:04 +00:00
char-device.h char-device: add 'self' param to vfuncs 2016-11-14 14:30:47 +00:00
common-graphics-channel.c Move RedClient to a separate file 2016-11-02 19:30:58 +00:00
common-graphics-channel.h Remove red_pipe_add_verb family function 2016-11-01 02:15:28 +00:00
cursor-channel-client.c Declare same enumerator in a single header 2016-10-20 08:27:50 +01:00
cursor-channel-client.h Declare same enumerator in a single header 2016-10-20 08:27:50 +01:00
cursor-channel.c Remove third argument from red_channel_client_init_send_data() 2016-12-20 16:11:39 +00:00
cursor-channel.h syntax-check: Remove trailing whitespace from EOL and EOF 2016-11-01 12:46:16 +00:00
dcc-private.h streaming: Always delegate bit rate control to the video encoder 2016-11-21 16:47:51 +00:00
dcc-send.c Increment correctly reference before adding the item to marshaller 2017-01-05 09:36:20 +00:00
dcc.c dcc: Avoid to include RedChannelClient private header 2016-12-02 22:15:02 +00:00
dcc.h streaming: Always delegate bit rate control to the video encoder 2016-11-21 16:47:51 +00:00
demarshallers.h Make sure all headers are independent 2016-05-18 00:24:37 +01:00
dispatcher.c dispatcher: write_safe: move EINTR debug message 2016-12-06 16:45:11 +00:00
dispatcher.h unify header include order 2016-05-12 11:02:54 +01:00
display-channel-private.h display-channel: Move _Drawable declaration to private header 2017-02-01 15:35:09 +00:00
display-channel.c display-channel: Remove current_size field 2017-01-31 10:06:58 +00:00
display-channel.h display-channel: Move _Drawable declaration to private header 2017-02-01 15:35:09 +00:00
display-limits.h worker: start a DisplayChannelClient unit 2015-11-19 12:43:02 +00:00
event-loop.c Remove core_public and core_interface_adapter globals usage 2016-11-15 16:49:09 +00:00
glib-compat.h display-channel: reuse function to set video codecs 2016-12-05 11:47:37 +00:00
glz-encode-match.tmpl.c server: rename _tmpl files 2015-11-26 13:33:36 +00:00
glz-encode.tmpl.c Fix -Werror=format with DEBUG_ENCODE 2016-07-01 14:00:37 +02:00
glz-encoder-dict.c remove glz_encoder_config.h 2015-12-04 11:57:18 +00:00
glz-encoder-dict.h remove glz_encoder_config.h 2015-12-04 11:57:18 +00:00
glz-encoder-priv.h Make sure all headers are independent 2016-05-18 00:24:37 +01:00
glz-encoder.c server: rename files 2015-12-03 23:54:32 +00:00
glz-encoder.h unify header include order 2016-05-12 11:02:54 +01:00
gstreamer-encoder.c gstreamer: Include only needed fields in SpiceFormatForGStreamer structure 2017-02-02 11:23:19 +00:00
image-cache.c Use SPICE_VERIFY macro for RHEL6 compatibility 2016-11-14 17:22:02 +00:00
image-cache.h Limit direct access to DisplayChannelClient 2016-08-09 10:22:46 -05:00
image-encoders.c image_encoders: check shared_dict before accessing it 2016-12-06 16:45:00 +00:00
image-encoders.h Do not declare image_encoders_compress_lz4 if LZ4 is not available 2016-11-01 10:30:27 +00:00
inputs-channel-client.c Remove third argument from red_channel_client_init_send_data() 2016-12-20 16:11:39 +00:00
inputs-channel-client.h Convert RedChannelClient hierarchy to GObject 2016-10-07 14:46:37 -05:00
inputs-channel.c Remove third argument from red_channel_client_init_send_data() 2016-12-20 16:11:39 +00:00
inputs-channel.h Convert RedChannel hierarchy to GObject 2016-10-25 11:32:13 -05:00
jpeg-encoder.c Sort include order in source files 2016-12-16 08:16:21 +00:00
jpeg-encoder.h server: rename files 2015-12-03 23:54:32 +00:00
lz4-encoder.c Use LZ4_compress_fast_continue if available 2016-11-28 18:38:22 +00:00
lz4-encoder.h server: rename files 2015-12-03 23:54:32 +00:00
main-channel-client.c Remove third argument from red_channel_client_init_send_data() 2016-12-20 16:11:39 +00:00
main-channel-client.h Avoid to typedef twice MainChannel 2016-10-20 17:01:19 +01:00
main-channel.c Remove unused and obsolete main_channel_close 2016-11-30 17:35:41 +00:00
main-channel.h Remove unused and obsolete main_channel_close 2016-11-30 17:35:41 +00:00
main-dispatcher.c Convert RedClient to GObject 2016-11-02 19:30:58 +00:00
main-dispatcher.h unify header include order 2016-05-12 11:02:54 +01:00
Makefile.am autotools: Add automake conditional for gstreamer 2017-02-03 09:08:55 +01:00
memslot.c Add a red_memslot_info_destroy function 2016-11-25 14:36:40 +00:00
memslot.h Add a red_memslot_info_destroy function 2016-11-25 14:36:40 +00:00
migration-protocol.h Fix 'freezed' typo 2016-09-09 14:56:31 +01:00
mjpeg-encoder.c Sort include order in source files 2016-12-16 08:16:21 +00:00
pixmap-cache.c Use SPICE_VERIFY macro for RHEL6 compatibility 2016-11-14 17:22:02 +00:00
pixmap-cache.h Fix 'freezed' typo 2016-09-09 14:56:31 +01:00
red-channel-client-private.h Make RedChannelClient::incoming private 2017-02-02 15:51:38 +00:00
red-channel-client.c Make RedChannelClient::incoming private 2017-02-02 15:51:38 +00:00
red-channel-client.h Make RedChannelClient::incoming private 2017-02-02 15:51:38 +00:00
red-channel.c Removed unused red_channel_pipes_new_add_tail function 2016-12-12 13:37:00 +00:00
red-channel.h channel: Remove commented out function prototype 2017-01-11 10:40:51 +00:00
red-client.c syntax-check: Include config.h file #include <> 2016-11-09 16:20:20 +00:00
red-client.h Convert RedClient to GObject 2016-11-02 19:30:58 +00:00
red-common.h Remove core_public and core_interface_adapter globals usage 2016-11-15 16:49:09 +00:00
red-parse-qxl.c red_get_image_data_flat: allocate mem after sanity check 2016-12-06 16:45:03 +00:00
red-parse-qxl.h Make QXLMessage handling safe 2016-11-09 16:43:40 +00:00
red-pipe-item.c MainChannel: remove another init_send_data arg 2016-12-20 16:11:13 +00:00
red-pipe-item.h MainChannel: remove another init_send_data arg 2016-12-20 16:11:13 +00:00
red-qxl.c red-worker: Introduce RedWorkerMessageGlDraw structure 2016-12-12 11:45:07 +00:00
red-qxl.h red-worker: Introduce RedWorkerMessageGlDraw structure 2016-12-12 11:45:07 +00:00
red-record-qxl.c red-record-qxl: child_output_setup: remove fcntl call 2016-12-06 16:45:08 +00:00
red-record-qxl.h replay: Remove time argument from recording functions 2016-11-10 21:51:25 +00:00
red-replay-qxl.c Free properly primary surface during replay 2016-12-05 23:27:35 +00:00
red-worker.c red-worker: Reuse code to process display command 2017-01-24 15:56:50 +00:00
red-worker.h Add red_qxl_destroy function 2016-12-02 15:53:39 +00:00
reds-private.h Make RedStatFile private inside stat-file.c 2016-11-16 16:38:32 +00:00
reds-stream.c reds-stream: Simplify error logic 2017-01-27 10:50:25 +00:00
reds-stream.h unify header include order 2016-05-12 11:02:54 +01:00
reds.c Add some NULL checks to spice_server_remove_interface() 2017-01-31 17:29:15 +00:00
reds.h Remove g_smartcard_channel global 2016-10-27 10:28:59 +01:00
smartcard-channel-client.c Remove third argument from red_channel_client_init_send_data() 2016-12-20 16:11:39 +00:00
smartcard-channel-client.h smartcard: Remove duplicate accessor 2016-11-21 14:40:47 +01:00
smartcard.c Remove third argument from red_channel_client_init_send_data() 2016-12-20 16:11:39 +00:00
smartcard.h Split RedCharDeviceSmartcard and SmartCardChannelClient 2016-09-30 13:14:03 +01:00
sound.c sound: Make clear active and client_active are boolean 2017-02-02 15:58:44 +00:00
sound.h Make sure all headers are independent 2016-05-18 00:24:37 +01:00
spice-audio.h Split spice.h 2014-11-27 14:27:18 +01:00
spice-bitmap-utils.c Handle top down bitmaps dumping 2016-11-15 14:12:25 +00:00
spice-bitmap-utils.h server: misc header cleanups 2015-12-09 22:17:51 +00:00
spice-bitmap-utils.tmpl.c server: rename _tmpl files 2015-11-26 13:33:36 +00:00
spice-char.h Constify spice_server_char_device_recognized_subtypes 2016-06-29 08:09:03 +01:00
spice-core.h Split spice.h 2014-11-27 14:27:18 +01:00
spice-experimental.h Add missing license headers 2015-10-19 14:25:36 +02:00
spice-input.h Split spice.h 2014-11-27 14:27:18 +01:00
spice-migration.h server: Use SPICE_GNUC_DEPRECATED to avoid a dependency on glib.h 2016-08-12 09:47:40 +01:00
spice-qxl.h Revert accidentally merged experimental patches 2016-11-09 13:54:58 +00:00
spice-replay.h Make red-replay-qxl.h a public header 2016-11-10 06:37:15 +00:00
spice-server-enums.tmpl.c syntax-check: Use templates for glib-mkenums 2016-11-14 17:45:32 +00:00
spice-server-enums.tmpl.h syntax-check: Use templates for glib-mkenums 2016-11-14 17:45:32 +00:00
spice-server.h Convert RedChannelClient hierarchy to GObject 2016-10-07 14:46:37 -05:00
spice-server.syms streaming: Let the administrator pick the video encoder and codec 2016-06-14 17:04:40 +02:00
spice-version.h.in build-sys: generate spice-version.h 2014-11-27 14:27:33 +01:00
spice.h Make red-replay-qxl.h a public header 2016-11-10 06:37:15 +00:00
spicevmc.c spicevmc: Avoid computing some variable value if not necessary 2017-02-01 08:47:07 +00:00
stat-file.c stat-file: Avoid compiler warning 2017-02-03 18:13:22 +00:00
stat-file.h Move some include from header to source 2016-11-30 15:44:28 +00:00
stat.h Separate code to manage statistic file 2016-11-16 16:38:13 +00:00
stream.c display-channel: Make video-codecs property read-write 2016-12-06 13:47:00 +01:00
stream.h streaming: Always delegate bit rate control to the video encoder 2016-11-21 16:47:51 +00:00
sw-canvas.c remove sw-canvas.h 2016-05-09 12:45:37 +01:00
tree.c Sort include order in source files 2016-12-16 08:16:21 +00:00
tree.h Introduce SPICE_UPCAST macro 2016-05-24 18:00:51 +01:00
utils.c worker: move dcc_add_surface_area_image 2015-11-23 13:50:44 +00:00
utils.h Avoid recursive inclusion of headers 2016-10-20 16:33:20 +01:00
video-encoder.h Make video-encoder.h self independent 2016-06-16 14:14:04 +01:00
zlib-encoder.c Sort include order in source files 2016-12-16 08:16:21 +00:00
zlib-encoder.h Make sure all headers are independent 2016-05-18 00:24:37 +01:00