Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1275847pxx; Fri, 30 Oct 2020 06:29:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc+z82RLPe9TF20oZj/8mWeYsCihY8/J+zhZKAZjQtjKX21bVhrIR1nAzDso9LEIqovEbI X-Received: by 2002:a17:907:4273:: with SMTP id nq3mr2528727ejb.439.1604064596235; Fri, 30 Oct 2020 06:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604064596; cv=none; d=google.com; s=arc-20160816; b=kDIL7tR26ybVgGJoFBgIEac5uKOzuubEp4hPRvWgEHQSh9MKADQedLSYGu2PNdsvHp /zgfOmqnhmjuGjrJ4vQsVdH/9OYLk4AjCo+Ci/MeyK9M8rAbE1Pl7Gmw2N4bmA6Hb48o Sy3FouetG4MGFOMTs5A8cAQTX4nRGVNa9F3Ap5SLFEfq5Q70ETO4QX4JppA53uvcbceY lw8qXbUObWrptitCFw6DG3q2We9Kvt4v1xSgnvGMrZPCdSYs3p2urXor5VQ+CxJp/rqQ GL/LV5hihE5A2AwJzgi64DFobyCYe3mhwjy0Jdv0vdp2XjyTJ1pwnRBvIRMJn1S2VIjp JvMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wG2sI8EW6iI9IIulD8zNExRHnDRv1t9L6KpFgetl1O0=; b=qYmaYSAkr487XdQ128LzoBjA25h3XmS09AkkPu2NiINUfKA8hYKfn4zmDPUpCiDXNA ZkFp23HI5jveWsfhkFKv+SNGr/+I0Ajd0xKmvaKlBsfAqJngGHJHbTBLWD0Esrnmae/0 JxCbOqM+mUJ0DTwLhRXzJq5xRRRV/GD+ScaKYTJUjbwXw0Jj0KTiP2iX0lF3M4xypHBI L/5EHt+TeNemOVtBPuLWYwRPg7Jcbi0cQOjEcojkIqfqqR8kRtM5w5FjjujwMKfd9WRG VtFlnttONx3cVIiVXC/z3aPfHAuiyOWSs7yvrnnH6sASKg7flCNkpJvJGj+cg6ha/mPS Z/rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@malat-biz.20150623.gappssmtp.com header.s=20150623 header.b=It8HY9X7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t2si4865453edc.547.2020.10.30.06.29.33; Fri, 30 Oct 2020 06:29:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@malat-biz.20150623.gappssmtp.com header.s=20150623 header.b=It8HY9X7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbgJ3N1A (ORCPT + 99 others); Fri, 30 Oct 2020 09:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbgJ3N07 (ORCPT ); Fri, 30 Oct 2020 09:26:59 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AD83C0613D5 for ; Fri, 30 Oct 2020 06:26:56 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id s9so6446482wro.8 for ; Fri, 30 Oct 2020 06:26:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=malat-biz.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wG2sI8EW6iI9IIulD8zNExRHnDRv1t9L6KpFgetl1O0=; b=It8HY9X7/21o8aISYouyA5HeQJR4CCaRRs3ChM8/RbuT86Cx9uowa8WNGRmEhBJpfU uV/tjlMepuV9TWvjZgT0SE/ExK0KLXrFQcGo++QJ1+5ItYLdB6GqdZ8aL3qg7ofLL46H M4QuaatKS9KZ2Au2x/jVA7IkcNBZ1cQ9suATXD3061TRSNrlM2+CrZUGOI4fpQ16A5py J1zWnauZrVz2F+Jfxcpa8xxFyX4RqITSMtXmD9UMVjFg8AwQs90tFR6pjgluERsE5SpH DmHHZALymZXhwfKJT0JOQsxV/F2Ujqe4kOHA4rBdoP2U4edrZ2kA0DTh8W6mRDW/RTOa eIgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wG2sI8EW6iI9IIulD8zNExRHnDRv1t9L6KpFgetl1O0=; b=ina9hAUEef9ZqDPWAX2kTwJTPpllbsRK0a53uFUHWQLsnINpqLonvz2lqHCJWP96fA btvcviOdp+kex6fzUEbye3zA+XnlM8pX++hm3ZWHTeMt9Ub47KEprgLBJSLN6/xuSHYQ lXBCyuQQ+uay/4vaA18ClM9iz2RuE4w+uO6BhDxs06SpnUKE9oWCAxNBW/dZ9VINAjr+ gvYshgyFY8jlsz9kOCiLzIYegrCxnKRAtvggUSQyuIIDW4zbUpPNQxTL+VLk7KYGot0L 71/L0YbH0k5H+gFTaJINmxMVKHOn2GHjMyqmRY9FanwMsH5I8O80WmJq2CnisPz1mzei oCXw== X-Gm-Message-State: AOAM533UhMDdEucnTN4z6Hgg7b1sn+9Hsts+f6398R+8eWhUuZaodrAL HKeJQYDwPX/YbFuTYe1nDpQiEg== X-Received: by 2002:adf:f9cf:: with SMTP id w15mr3237771wrr.185.1604064414963; Fri, 30 Oct 2020 06:26:54 -0700 (PDT) Received: from ntb.petris.klfree.cz (snat2.klfree.cz. [81.201.48.25]) by smtp.googlemail.com with ESMTPSA id z15sm10160401wrq.24.2020.10.30.06.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 06:26:54 -0700 (PDT) From: Petr Malat To: linux-sctp@vger.kernel.org Cc: Petr Malat , Vlad Yasevich , Neil Horman , Marcelo Ricardo Leitner , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] sctp: Fix COMM_LOST/CANT_STR_ASSOC err reporting on big-endian platforms Date: Fri, 30 Oct 2020 14:26:33 +0100 Message-Id: <20201030132633.7045-1-oss@malat.biz> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 978aa0474115 ("sctp: fix some type cast warnings introduced since very beginning")' broke err reading from sctp_arg, because it reads the value as 32-bit integer, although the value is stored as 16-bit integer. Later this value is passed to the userspace in 16-bit variable, thus the user always gets 0 on big-endian platforms. Fix it by reading the __u16 field of sctp_arg union, as reading err field would produce a sparse warning. Signed-off-by: Petr Malat --- net/sctp/sm_sideeffect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index aa821e71f05e..813d30767204 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c @@ -1601,12 +1601,12 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, break; case SCTP_CMD_INIT_FAILED: - sctp_cmd_init_failed(commands, asoc, cmd->obj.u32); + sctp_cmd_init_failed(commands, asoc, cmd->obj.u16); break; case SCTP_CMD_ASSOC_FAILED: sctp_cmd_assoc_failed(commands, asoc, event_type, - subtype, chunk, cmd->obj.u32); + subtype, chunk, cmd->obj.u16); break; case SCTP_CMD_INIT_COUNTER_INC: -- 2.20.1