lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1424791511-11407-3-git-send-email-daniel.sanders@imgtec.com>
Date:	Tue, 24 Feb 2015 15:25:09 +0000
From:	Daniel Sanders <daniel.sanders@...tec.com>
To:	unlisted-recipients:; (no To-header on input)
CC:	Toma Tabacu <toma.tabacu@...tec.com>,
	Daniel Sanders <daniel.sanders@...tec.com>,
	Ralf Baechle <ralf@...ux-mips.org>,
	Andreas Herrmann <andreas.herrmann@...iumnetworks.com>,
	David Daney <david.daney@...ium.com>,
	Manuel Lauss <manuel.lauss@...il.com>,
	<linux-mips@...ux-mips.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 2/4] MIPS: LLVMLinux: Fix a 'cast to type not present in union' error.

From: Toma Tabacu <toma.tabacu@...tec.com>

Remove a cast to the 'mips16e_instruction' union inside an if
condition and instead do an assignment to a local
'union mips16e_instruction' variable's 'full' member before the if
statement and use this variable in the if condition.

This is the error message reported by clang:
arch/mips/kernel/branch.c:38:8: error: cast to union type from type 'unsigned short' not present in union
                if (((union mips16e_instruction)inst).ri.opcode
                     ^                          ~~~~

The changed code can be compiled successfully by both gcc and clang.

Signed-off-by: Toma Tabacu <toma.tabacu@...tec.com>
Signed-off-by: Daniel Sanders <daniel.sanders@...tec.com>
Cc: Ralf Baechle <ralf@...ux-mips.org>
Cc: Andreas Herrmann <andreas.herrmann@...iumnetworks.com>
Cc: David Daney <david.daney@...ium.com>
Cc: Manuel Lauss <manuel.lauss@...il.com>
Cc: linux-mips@...ux-mips.org
Cc: linux-kernel@...r.kernel.org
---
v2 refreshes the patch.

 arch/mips/kernel/branch.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index c2e0f45..c0c5e59 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -36,8 +36,10 @@ int __isa_exception_epc(struct pt_regs *regs)
 		return epc;
 	}
 	if (cpu_has_mips16) {
-		if (((union mips16e_instruction)inst).ri.opcode
-				== MIPS16e_jal_op)
+		union mips16e_instruction inst_mips16e;
+
+		inst_mips16e.full = inst;
+		if (inst_mips16e.ri.opcode == MIPS16e_jal_op)
 			epc += 4;
 		else
 			epc += 2;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ