mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 01:51:51 +00:00
sk-queue: Use int values in getsockopt
The kernel threats them as interger values so we should declare them this way. Moreover, explicitly clean them up to eliminate side effects. Initially I hit a problem where high bits of long "size" variable was containing some crap from stack and in result I've got errors like | Error (sk-queue.c:102): dump_sk_queue: Can't allocate 171798904800 bytes | Error (cr-dump.c:1289): Dump files (pid: 2505) failed with -1 Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Acked-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
c256706a09
commit
8e195849a3
@ -59,14 +59,14 @@ int read_sk_queues(void)
|
||||
int dump_sk_queue(int sock_fd, int sock_id)
|
||||
{
|
||||
struct sk_packet_entry *pe;
|
||||
unsigned long size;
|
||||
int ret, size, orig_peek_off;
|
||||
socklen_t tmp;
|
||||
int ret, orig_peek_off;
|
||||
|
||||
/*
|
||||
* Save original peek offset.
|
||||
*/
|
||||
tmp = sizeof(orig_peek_off);
|
||||
orig_peek_off = 0;
|
||||
ret = getsockopt(sock_fd, SOL_SOCKET, SO_PEEK_OFF, &orig_peek_off, &tmp);
|
||||
if (ret < 0) {
|
||||
pr_perror("getsockopt failed\n");
|
||||
@ -76,6 +76,7 @@ int dump_sk_queue(int sock_fd, int sock_id)
|
||||
* Discover max DGRAM size
|
||||
*/
|
||||
tmp = sizeof(size);
|
||||
size = 0;
|
||||
ret = getsockopt(sock_fd, SOL_SOCKET, SO_SNDBUF, &size, &tmp);
|
||||
if (ret < 0) {
|
||||
pr_perror("getsockopt failed\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user