From patchwork Wed Apr 25 07:15:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: solomon X-Patchwork-Id: 154815 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2F159B6FBB for ; Wed, 25 Apr 2012 17:14:33 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752290Ab2DYHOb (ORCPT ); Wed, 25 Apr 2012 03:14:31 -0400 Received: from mail-pz0-f51.google.com ([209.85.210.51]:33714 "EHLO mail-pz0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750849Ab2DYHOa (ORCPT ); Wed, 25 Apr 2012 03:14:30 -0400 Received: by dadz8 with SMTP id z8so1990313dad.10 for ; Wed, 25 Apr 2012 00:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=/+XZmkyWzpO0OR2FKRDRCXif42IZFd0Ss1GR842wPDo=; b=H6kFV6BWubA4xj7qgK9LjDTTrthTd98cljvJ1OiHLmSSkYGCmOnrAkrTmNEp1b+Gyv hUcRmii4H1lkB78cUEAJrNzwvAl0p20gIJBcx2vVY4XD6xZkY1f/OSSYwg2cnVjOkCvM 53UTWVT21+sKuB+sejWizfgJTD/5Yo82MhOs+okf07Bh3NfMg2gjK1c3Dk/cLhLhWCsF St8sYIhUZyiYMgOKYJxOKK+kIwZ/F++LBBG2b1l0ajKfU8I19deq8f11BsTpyG1oIiaM iMlicfHfv2S+wCq/Hr8OHEbsmzCRLLwRR+AzxGzKrCbdiReW/cp3eDnI5aDRv1TFGNVC FaxQ== Received: by 10.68.190.69 with SMTP id go5mr5380287pbc.98.1335338069994; Wed, 25 Apr 2012 00:14:29 -0700 (PDT) Received: from [172.30.10.112] ([113.108.76.195]) by mx.google.com with ESMTPS id d6sm19720617pbi.23.2012.04.25.00.14.26 (version=SSLv3 cipher=OTHER); Wed, 25 Apr 2012 00:14:29 -0700 (PDT) Message-ID: <4F97A484.2040300@gmail.com> Date: Wed, 25 Apr 2012 15:15:16 +0800 From: Shan Wei User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: xemul@parallels.com, Stephen Hemminger CC: NetDev Subject: [PATCH 1/2] ss: fix the incorrect value of total UNIX_DIAG_* number Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Shan Wei UNIX_DIAG_MAX is included in enum type. It is equal to the total number of enum element. But lots of enum MAX value is defined as the max enum element, e.g. INET_DIAG_MAX, XFRMA_MAX. The right fixing way seems to define UNIX_DIAG_MAX as UNIX_DIAG_MEMINFO, but this way will break other user application. So, just fix it on user application. Signed-off-by: Shan Wei --- misc/ss.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/ss.c b/misc/ss.c index 4017918..5f70a26 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -2011,12 +2011,12 @@ void unix_list_print(struct unixstat *list, struct filter *f) static int unix_show_sock(struct nlmsghdr *nlh, struct filter *f) { struct unix_diag_msg *r = NLMSG_DATA(nlh); - struct rtattr *tb[UNIX_DIAG_MAX+1]; + struct rtattr *tb[UNIX_DIAG_MAX]; char name[128]; int peer_ino; int rqlen; - parse_rtattr(tb, UNIX_DIAG_MAX, (struct rtattr*)(r+1), + parse_rtattr(tb, UNIX_DIAG_MAX-1, (struct rtattr*)(r+1), nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*r))); if (netid_width)